Git is the open source distributed version control system that facilitates GitHub, Bitbucket and GitLab activities on your desktop or laptop computer. This cheat sheet summarizes commonly used Git command line arguments for quick reference.
The following command line arguments are to configure user information for all local repositories.
Sets the name you want attached to your commit transactions
git config --global user.name "Orestis Pantazos"
Sets the email you want attached to your commit transactions
git config --global user.email "email@example.com"
When starting out with a new repository, you only need to do it once; either locally, then push to GitHub, or by cloning an existing repository.
Turn an existing directory into a git repository.
Clone and download a repository that already exists on GitHub, including all of the files, branches and commits.
git clone https://github.com/orestispantazos/java-ee-kickoff-app
Branches are an important part of working with Git. Any commits you make will be made on the branch you are currently checkout out to. Use
git status to see and check which branch that is.
Creates a new branch
git branch hotfix/test
Switches to the specified branch and updates the working directory
git checkout hotfix/test
Combines the specified branch's history into the current branch. This is usually done in pull requests, but is an important Git operation.
git merge hotfix/test
Deletes the specified branch
git branch -d hotfix/test
The .gitignore file
It may be a good idea sometimes to exclude files from being tracked with Git. This is typically done in a special file name
Synchronize your local repository with the remote repository on GitHub.com.
Combines remote tracking branch into current local branch.
Uploads all local branch commits to GitHub.
Updates your current local working branch with all new commits from the corresponding remote branch on GitHub.
git pull is a combination of
git fetch and
🔁 To Be Continued 🔁