- Cheat Sheet and Example is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools







Git - How to use Git.


  • Git is a distributed revision control and source code management (SCM) system.
  • Git is a version control system (VCS) for tracking changes in computer files and coordinating work on those files among multiple people.

Web Sites

Companies & Projects Using Git

Google, facebook, Microsoft, twitter, Linux, eclipse

Git Flow Image

Git Flow Image



Command Explanation Example
git --version Disaplay git version
git config --list
git config


~]$ git config --global XXXXX
~]$ git config --global
~]$ git config --global --list   <- check
~]$ cat ~/.gitconfig

Setting Up a Git Repository

Command Explanation Example
git init Create an empty Git repository or reinitialize an existing one git init --bare project1 ← --bare: Create minimum reposibotry
git init --bare --share project1 ← --share: Permit push with same GID
git clone git clone project1 testclone

git remote
Command Explanation
git remote add NAME URL
git remote add origin
git remote -v list remote repository
git remote show NAME
git remote show origin
show remote repository with detail
git remote rename OLDNAME NEWNAME
git remote rm NAME
git remote rm origin

Daily Work

Command Explanation Example
git pull Update local repogitory from remote repogitory git pull origin master
git add Add file contents to the index git add test.txt
git add -p ← all files of changed
git add . ← new add and edit files
git add -u ← delete files, edit files, not new files
git add -all or git add -A ← both . and -u
git rm git rm -f test.txt
git commit Record changes to the repository git commit -m “message”
git commit -a
git status Show the working tree status
git diff
git log Show commit logs git log
git log --until=2017-01-18 / git log --before=2017-10-15
git log --after=2017-01-20 / git log --since=2017-10-15
git log --grep='XXXX'
git log --oneline
git log --graph --decorate --oneline
git checkout git checkout .
git checkout -f master
git revert git revert HEAD
git reset
git clean Remove untracked files from the working tree git clean -n ← check only(dispalay a deleting files. not delete)
git clean -df ← directory adn file
git clean -xf


Command Explanation Example
git branch -a Check Branch
git branch NEW Crate Branch
git checkout NEW Change Branch

middleware/version-control/git/index.html.txt · Last modified: 2019/05/12 by admin

Page Tools