git clone URL |
Download a copy a remote repository |
git init |
Convert current directory into a new Git repository |
git status |
Get a status report your repository |
git add --all |
Add all changed and new files to the staging area of your repository |
git commit -m "message" |
Commit all staged files to your repository |
git log |
Review a repository's history |
git log --oneline |
View a condensed history of your project |
git branch --list |
List all local branches |
git branch --all |
List local and remove branches |
git branch --remotes |
List all remote branches |
git checkout --track remote_name/branch |
Create a copy of a remote branch for local use |
git checkout branch |
Switch to a different local branch |
git checkout -b branch branch_parent |
Create a new branch from a specified branch |
git add filename(s) |
Stage only the specified file so that it is ready to be committed |
git add --patch filename |
Stage only portions of a file so that they are ready to be commiitted |
git reset HEAD filename |
Remove proposed file changes from the staging area |
git commit --amend |
Update the previous commit with changes currently staged, and supply a new commit message |
git show commit |
Log details for a single commit |
git tag tag commit |
Add a tag to a commit object |
git tag |
List all tags |
git show tag |
Log detail for the commit where the tag was applied |
git remote add remote_name URL |
Create a new reference to a new remote repository |
git push |
Upload changes for the current branch to a remote repository |
git remote --verbose |
List the fetch and push URLs for all available remotes |
git push --set-upstream remote_name branch_local branch_remote |
Push a copy of your local branch to the remote server |
git merge branch |
Incorporate the commits currently stored in another branch into the current one |
git push --delete remote_name branch_remote |
Remove named branch from the remote server |
git reset --hard HEAD -- filename |
restore file |
git reset --hard HEAD |
restore in the previous commit |