githelp 1.82 KB
Newer Older
Benoit Viguier's avatar
Benoit Viguier committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
echo "
list of commands that you might want to know
git add -A			: add all files
git add --all			: add all files
git add -u			: update modified files
git commit -m <msg>		: commit some changes with <msg>
git commit -am <msg>		: git add -u + git commit -m

git mv <source> <destination>	: move a file/folder

git status			: check local status
git fetch			: check for changes online
git pull			: check for changes online and update local
git push			: push your commited changes online


REVERT CHANGES :
git checkout -- <file>		: reset your file/folder to the last commit
git stash			: reset your local repo to the last commit

git reset --hard                : complete reset to the last commit
/!\ your changes will be destroyed


IN CASE OF CONFLICT :
git fetch --all
git reset --hard origin/master
/!\ your changes will be destroyed



TO MERGE IN CASE OF CONFLICT : 
git fetch			: parse the last modifications
git difftool			: merge the files
Edit the files (chose the right parts), commit and push.


MORE ADVANCED STUFF :
git stash save <message>	: save temporarly your changes and revert
git stash list			: show the list of the previous \"stash\"
git stash clear			: clear the previous list
git stash pop			: return to your working state


BRANCHES
git checkout -b <branch name> : create a branch <branch name>
git checkout <branch name> : switch to branch <branch name>
git push -u --all

git checkout <commit number> : switch to this commit /!\ DANGEROUS

MERGE /!\ DANGEROUS
git merge <branch name> merges ROOT BRANCH (the one you are on, see git status) with <branch name>.
The changes are done on ROOT BRANCH.

alias gtree='git log --oneline --decorate --all --graph'

Add this to .git/config in order to have a nice output on ''git log''
[log]
	date = short
[format]
	pretty = format:%C(yellow)%h %>(10)%Cred%ad %<(13)%C(cyan)%an %Cgreen%d %Creset%s"