-
Notifications
You must be signed in to change notification settings - Fork 5
/
notes.txt
executable file
·79 lines (55 loc) · 2.5 KB
/
notes.txt
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Github training
//force clfr line endings
git config --global core.autocrlf input
//initialise the current folder as a GIT repo (can also be passed
git init
//adds everything from this point to add to your initialised git folder
//add stages the change for next commit (not just adding a new file)
//-p is for patch , shows local changes
//-A ignores the fact the file is not present (2.0 doesn't need this)
git add .
//commit with a message
git commit -m "message"
//get status of folder
git status
has three sections
section1 is changes ready for commit
section 2 is changes to existing files, that are not staged
section 3 is untracked files, new files not part of source control
//get log of actions
//gives you a full log of commit history
//q is for quit, page dn and up also work
git log
//gives you first 7 characters of commit hash and message ofr overview of recent changes
git log --oneline
//gives a more detailed list of changes for the current repo
git log --stat
//shows what went in, in patch format
git log --patch
//shows branches in "asci art"
git log --online --all --graph --decorate
//show every difference in changes to existing tracked files and staged files(section 1 & 2 above)
git diff
//shows changes to stages files (i.e not including changes to files in section 2 above)
git diff --staged
//can loose work in git, has 3 modes
//--soft, changes index files for staging area, defaults to head when revision number not set
//--hard, loses without trace changes to a file in staged area and unstaged tracked file area, reverting local changes
//can also be used to revert commits
git reset
//amend changes message on previously commit, cant add or change files
git commit --amend
//rename a file
git mv
//git ignore goes into the root, but can have one in every folder defining whats to be ignored there
.gitignore
GIT2.0 is changing mainly the default configs and messages
//git checkout command changes branch (hg update)
bash completion is a tool that puts branch in the command line
//--noff skips fast forward merge
git merge
//commit message during a conflict is saved to git folder, after resolving merge conflict, run "git commit" as it needs to finish the //current merge conflict, i.e. you cannot run 'git commit -m "message"'
//-u is only needed the first time
git push -u
//downloads the changes but stores in .git directory so you cant see anything locally, but all files and meta data have been downloaded
git fetch