Please enable JavaScript.
Coggle requires JavaScript to display documents.
Git Tutorial (Tag (git tag <tagname> ( tag to HEAD), git tag -a <…
Git Tutorial
Tag
git tag <tagname> ( tag to HEAD)
git tag -a <tagname> -m "<message>"
git tag
git show <tagname>
git push origin <tagname>
git push origin --tags
git tag -d <tagname> ( Delete local tag)
git push origin :refs/tags/<tagname> (Delete remote tag)
Commands
Git Repo sync
git rebase
git fetch
git commit
git merge
git push
git pull
git clone
git init
Git changes
git commit -am <commit message>
git reset <filename>
git diff head - WD vs master
git add <filename>
git diff - WD vs Stage
git status
git diff --cached - Stage vs master
Git configuration
git config --global user.email "user e-mail"
git config --global user.name "name"
Git Linux commands
git grep <search-term>
git mv <filename>
git rm <filename>
Git history
git show
git log
Git conflict
commit before
git stash
git pull
git stash pop
git add.
git commit
git push
change the confilict
commit after
Branching
Create and Merge
git checkout -b <branch>
git branch
git checkout master
git merge <branch> Fast-forward
git branch -d <branch>
git branch -D <name> ( force delete branch without any merge)'
Strategy of managing branch
git checkout -b <branch>
git checkout master
git add
git commit -m "<commit text>"
git merge --no-ff -m "<message>" <branch>
git log --graph --pretty=oneline --abbrev-commit
Stash
git stash ( save WD and stage on <branch> )
git stash list
git stash apply
git stash drop
git stash pop ( apply and drop)
git stash apply stash@{0}
Co-work
git remote -v
git push origin <branch>
git clone <git ssh address>
git checkout -b <branch> origin/<branch>
git pull (fixed the conflict)
git branch --set-upstream-to=origin/<branch> <branch>
git commit
git push origin <branch>
Rebase
git rebase
Custmized git
git config --global color.ui true
git config --global user.name "Your Name"
git config --global user.email
"email\@example.com
"
Ingore special files
.gitignore
Windows
Thumbs.db
ehthumbs.db
Desktop.in
Python
*.py[cod]
*.so
*.egg
*.egg-info
dist
build
git check-ignore -v <file>
GitHub
Add remote repository
Set SSH
ssh-keygen -t rsa -C
"youremail\@example.com
"
add SSH key in account settings of GitHub
Clone
create repo in github
git clone
git\@github.com
:<your git>/<git repo name>
Time machine
Working directory and Stage
Repository
Master - commit history
HEAD
Stage(Index) git commit ( Stage - > Master)
Working Directory
git add( WD -> Stage)
Manage Changes
git checkout -- <file name> ( Lastest Stage -> WD or master -> WD )
git reset HEAD <file> ( HEAD master - > WD, Stage )
git reset --hard commit_id ( master -> WD, Stage)
git reset --soft - Stage -> WD
git reset --mixed - master -> Stage
Remove file
rm <file name> ( WD)
git rm <file name> ( remove Stage)
Versoin rollback
git reflog
git reset --hard commit_id
git reset --hard HEARD^
git log --pretty=oneline
git commit -m "<commit text>"
git add <file name>
Introduction
Create Repo
git commit -m "<commit text>"
git add <file name>
git init
mk dir learngit
create empty repo in Github
git remote add origin <git ssh address or git https address>
git push origin master
Install
Windows
Mac
XCode Download CLT install Git
Homebrew
$ brew install git
Linux
sudo apt-get install git