logo
search-iconinfo-iconinfo-icon

Commands

Command Description
git init Create a new local repository
git clone /path/to/repository Create a working copy of a remote repository
git add [filename] Add files to staging
git commit -m "Commit message" Commit changes to head
git commit -a Commit any files you've added with git add, and also commit any files you've changed since then
git mv [source] [destination] Move or rename a file, a directory, or a symlink
git rm [path] Remove files from the working tree and from the index
git push [remote] [branch] Send changes to a branch of a specified remote repository
git status List the files you've changed and those you still need to add or commit
git remote add [shortname] [url] Add a new remote repository
git remote -v List all remote repositories
git checkout -b [branch] Create a new branch and switch to it
git checkout [branch] Switch from one branch to another
git branch List all the branches in your repo
git branch -d [branch] Delete the feature branch
git fetch [remote] Download objects and refs from another repository
git push --all origin Push all branches to your remote repository
git push origin :[branch] Delete a branch on your remote repository
git pull Update from the remote repository. Fetch and merge changes on the remote server to your working directory
git merge [branch] To merge a different branch into your active branch
git diff Preview changes
git tag 1.0.0 [commitID] Create a tag
git push --tags origin Push all tags to remote repository
git checkout -- [filename] Undo changes made to a file
edit-iconEdit this page