This is the Git module. Here you will find all the resources and lessons related to Git, version control, and collaboration.
Git is used to track changes in the code of the project, collaborate with others and keep versions of the project.
Key features of Git include:
List of commands:
git init - Initializes a new Git repository.git clone [url] - Clones an existing repository from a remote source.git add [file] - Stages changes to be committed.git commit -m "message" - Commits staged changes.git status - Shows the status of the working directory and staging area.git log - Displays the history.git branch - Lists all branches.git checkout [branch] - Switches to a different branch.git merge [branch] - Merges changes from one branch into another.git pull - Fetches and merges changes from a remote repository.git push - Pushes local commits to a remote repository.Note: Using GitHub for Desktop or Visual Studio can simplify the process of managing repositories and performing Git operations through a graphical interface.
.gitignore: The .gitignore file is used to specify files and directories that should be ignored by Git.
.gitattributes: The .gitattributes file is used to define attributes for paths in the repository. Helps avoid noisy Windows/Linux diffs.
Branching: Git allows you to create branches, which are separate lines of development. Useful for working on new features or bug fixes without affecting the main branch.
Example of creating and switching to a new branch:
git checkout -b branch-name
Merging: When finishing a feature or bug fix, you can merge it back into the main branch.
Example of merging a branch:
git checkout main git merge branch-name
OBS:On another note, using the VS addons like, GitLens or Git Graph, can provide a more visual and intuitive way to manage branches and merges.
Git Push: The git push command is used to upload a local repository to a remote repository.
Example of pushing changes to a remote repository:
git push origin branch-name
Git Pull: The git pull command is used to fetch and merge changes from a remote repository into your current branch.
Example of pulling changes from a remote repository:
git pull origin branch-name
Remote Repositories: Is a version of your project hosted on the internet or another network. It allows you to collaborate with others and share your code.
README.md: The README.md file is a markdown file that provides information about the project. It typically includes a project description, installation instructions, usage guidelines, and other relevant details.
OBS: This project doesn't include the last 4 sections because it is meant to be a Exercise/Lesson from the DevClub Git Module.