Git git, memos

Basic

git init

git status # list of modifications
git add .  # add all change 
git commit -m "message" # save all change    

Remote & local

git remote -v # list dépots

git branch # list all branch
git checkout -b branch_name # create a new branch and use it
git checkout master # change to branch master
git branch -a # list all branch, local and remote
git branch -d branch_name # delete branch_name
git push origin branch_name # puts the branch to the distant depot
git push origin master # puts the modification to the distant depot
git merge branch_name # fusion with master and branch_name

git tag tag_name # create a new tag

git log # show the log
git log --oneline -2 # last 2 commit
git log -1 --pretty=%B # last commit message

A better git log : aliasing command

git lg
git lgf

Classics alias

st = status -s
cl = clone
ci = commit
co = checkout
br = branch 
logtree = log --graph --oneline --decorate --all
changes = diff --name-status
ll = log --stat --abbrev-commit

Git tag

git tag v0.1.2
git push origin --tags # publish all tags on remote

How to discard all deleted files since last commit :

git add -u

How to discard all change since the last commit :

First discard modified files :

git checkout -- .

And discard the new untracked files (first with -n just for checking, and for real without it)

git clean -f -d -n 

Check this one :


comments powered by Disqus