Next: Resources, Previous: Development Stuff, Up: Top [Contents][Index]
This appendix provides an alphabetical list of the Git commands cited in this Web page, along with brief descriptions of what the commands do.
Note that you may always use either ‘git help command’ or ‘git command --help’ to get short, man-page style help on how to use any given Git command.
git addAdd a file to the list of files to be committed.
git branchView existing branches, or delete a branch. Most useful options: -a and -d.
git checkoutCheckout an existing branch, create a new branch, or checkout a file to reset it. Use the -b option to create and checkout a new branch in one operation.
git cloneClone (make a new copy of) an existing repository. You generally only need to do this once.
git commitCommit changes to files which have been staged for committing with ‘git add’. This makes your changes permanent, in your local repository only. To publish your changes to an upstream repo, you must use ‘git push’.
git configDisplay and/or change global and/or local configuration settings.
git diffShow a unified-format diff of what’s changed in the current directory as of the last commit. It helps to have Git configured to use its builtin pager for reviewing diffs (see Configuring git).
git difftoolUse a “tool” (usually a GUI-based program) to view differences, instead of the standard textual diff as you’d get from ‘git diff’.
git fetchUpdate your local copy of the upstream’s branches. That is, update the various ‘origin/’ branches. This leaves your local tracking branches unchanged. With the --prune option, this removes any copies of stale ‘origin/’ branches.
git format-patchCreate a series of patch files, one per commit not on the original branch from which you started.
git gcRun a “garbage collection” pass in the current repository.
This can often reduce the space used in a large repo. For
gawk it does not make that much difference.
git helpPrint a man-page–style usage summary for a command.
git logShow the current branch’s commit log. This includes who made the commit, the date, and the commit message. Commits are shown from newest to oldest.
git mergeMerge changes from the named branch into the current one.
git pullWhen in your local tracking branch xxx,
run ‘git fetch’, and then merge from origin/xxx
into xxx.
git pushPush commits from your local tracking branch xxx
through origin/xxx and on to branch xxx
in the upstream repo. Use ‘git push -u origin --delete xxx’ to delete
an upstream branch. (Do so carefully!)
git rebaseRebase the changes in the current purely local branch to
look as if they had been made relative to the latest
commit in the current upstream branch (typically master).
This is how you keep your local, in-progress changes up-to-date
with respect to the original branch from which they were started.
git resetRestore the original state of the repo, especially with the --hard option. Read up on this command, and use it carefully.
git statusShow the status of files that are scheduled to be committed, and those that have been modified but not yet scheduled for committing. Use ‘git add’ to schedule a file for committing. This command also lists untracked files.
Next: Resources, Previous: Development Stuff, Up: Top [Contents][Index]