Table of contents
No headings in the article.
- Repository Creation
- Repository Observation
- Branches
- Changes
- Push, Reset, and Status
- Pull
- Help
- Repository Creation To create a new local repository from start :
$ git init
To clone an existing repository :
$ git clone your_url
- Repository Observation Shows new or modified files not yet committed :
$ git status
Shows the changes made to files :
$ git diff
- Branches List all local branches :
$ git branch
List all local and remote branches :
$ git branch -av
To merge branch_a into branch_b :
$ git checkout branch_b
$ git merge branch_a
To tag the current commit :
$ git tag <my-tag>
- Changes To stage the file ready for commit :
$ git add <file-name>
To stage all changed files ready for commit :
$ git add
To commit all staged files to versioned history :
$ git commit - m <message>
To commit all tracked files to versioned history :
$ git commit - am <message>
To show full changed history :
$ git log
- Push, Reset, and Status To push local changes to remote repo :
$ git push
To push all of the tags to the remote repo :
$ git push --tags <repo-name>
To unstage a staged file :
$ git reset <file-name>
To reset everything to the last commit :
$ git reset --hard HEAD
To get the current status of the repository :
$ git status
- Pull To get the latest changes from the remote repo
$ git fetch
To get the latest changes from the remote repo and merge
$ git pull
- Help To get help
$ git help