Skip to article frontmatterSkip to article content

Summary Table of Git Commands

(rr-vcs-git-summary)

Summary Table of Git Commands

CommandUse
git initInitialises a Git repository in that directory
git add .Adds all changes to the staging area to be committed
git add file_nameAdds changes to the specified file to the staging area to be committed
git commitCommits staged changes and allows you to write a commit message
git checkout SHAChecks out a past commit with the given SHA
git checkout SHA -- file_nameChecks out the past version of a file from the commit with the given SHA
git checkout -b branch_nameCreates and switches to a new branch
git checkout branch_nameSwitches to the specified branch
git merge branch_nameMerges the branch you are on into the specified branch
git logOutputs a log of past commits with their commit messages
git statusOutputs status, including what branch you are on and what changes are staged
git diffOutputs the differences between the working directory and most recent commit
git diff thing_a thing_bOutputs the differences between two things, such as commits and branches
git clone URLMakes a clone of the repository at the specified URL
git remote add origin URLLinks a local repository and an online repository at the specified URL
git push origin branch_namePushes local changes to the specified branch of the online repository
git pull origin branch_namePull changes from the online repository into local repository