commands to be executed in the repository directory or any of its subdirectories
initially copy a repository
git clone http://gitserver/myrepository
list current changes
git status
add changes to the transaction
git add file-path ... git add --all
create a commit
git commit
show history
git log
get all new changes from a remote
git fetch
get and merge all new changes from a remote
git pull
list remotes
git remote
add a new remote
git remote add github http://github.com/user/myrepository
list local branches
git branch
list remote branches
git branch -r
create a new branch
git checkout -b {branch-name}
checkout a remote branch
git checkout -b {branch-name}
go to an old state
git checkout {commit-id}
switch to another branch
git checkout otherbranch
reset only one specific file to the last commit
git checkout filepath
merge another branch into the current branch
git merge otherbranch
pull from another remote
git pull github
push to another remote
git push github
add a submodule
git submodule add http://gitserver/otherrepository
download submodule contents
git update
rename or move a submodule
git mv a b
show differences
git diff
show differences for a specific file
git diff my/file/path.scm
show differences to a specific commit
git diff -- {commit-id}
merge a single commit from another branch
git cherry-pick
remove uncommitted changes only from the index
git reset
delete uncommitted changes completely and permanently
git reset --hard
uncommit the most recent local commit
git reset --soft HEAD^
create a new commit that reverts to the state at an old commit
git revert
copy all files to a tar archive without the .git directory and without files that match .gitignore
git archive branchname destination.tar
tag the current commit
git tag add {tagname}
add your local tags to the remote
git push --tags
delete a remote tag
git push origin --delete {tagname}
delete a remote branch
git push origin --delete {branchname}
create a new database-only git repository
git init --bare
delete local branches that do not exist on remote
git remote prune origin