Automated Version Control
|
|
Setting Up Git
|
Use git config to configure a user name, email address, editor, and other preferences once per machine.
|
Creating a Repository and Tracking Changes
|
git init initializes a repository.
git status shows the status of a repository.
Files can be stored in a project’s working directory (which users see), the staging area (where the next commit is being built up) and the local repository (where commits are permanently recorded).
git add puts files in the staging area.
git commit saves the staged content as a new commit in the local repository.
Always write a log message when committing changes.
|
Exploring History
|
|
Ignoring Things
|
|
Working with Branches
|
git branch to view current branches
git branch branch-name to create a new branch
git checkout branch-name to switch to a branch
git branch -m branch-name to rename a branch
git merge branch-name to merge a branch
git branch -d delete-me to delete a branch
Checking out a branch changes the “active” files in your repository directory.
Merging applies commits from one branch to another.
Merge commits are used to glue two histories together.
|
Remotes
|
A local Git repository can be connected to one or more remote repositories.
Use the HTTPS protocol to connect to remote repositories until you have learned how to set up SSH.
git push copies changes from a local repository to a remote repository.
git pull copies changes from a remote repository to a local repository.
|
Collaborating
|
|
Graphical User Interface (GUIs)
|
|
Conflicts
|
Conflicts occur when two or more people change the same file(s) at the same time.
The version control system does not allow people to overwrite each other’s changes blindly, but highlights conflicts so that they can be resolved.
|
Both resources are also available in other languages e.g. Spanish, French, and more.