git command reference

part of about git

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 and merge all new changes from a remote

git pull

add and use 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

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

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 last commit

git tag add {tagname}

add your local tags to the remote

git push --tags

create a new database-only git repository

git init --bare

tags: programming start computer git vcs reference commands