-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGit.txt
More file actions
63 lines (42 loc) · 1.29 KB
/
Git.txt
File metadata and controls
63 lines (42 loc) · 1.29 KB
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
[Cheat Sheet](http://help.github.com/git-cheat-sheets/)
{GitRepositories}
[Branching Strategy Overview](http://nvie.com/posts/a-successful-git-branching-model/)
Prepare folder:
`git init`
Checkout:
`git clone git@github.com:plafond/wiki.git`
Add:
*all new files:* `git add .`
*specific file:* `git add $file$`
Delete file:
`git rm $file$`
Commit all changes:
`git commit -a`
`git commit -m "message"` -> add comment
`git commit -v` -> show diff
`git commit -a -v` -> can combine
List files added:
`git ls-files`
Log/comments:
`git log` -v and --stat are options
Push changes to master(remote) repo:
`git push origin`
Update local branch:
`git pull`
Get repo without merging:
`git fetch $repo_name$`
Get repo WITH merging:
`git merge $repo_name$/$local_branch$`
Setup user on new machine:
`git config --global user.name "plafond"`
`git config --global user.email plafond@gmail.com`
Initial commit (after add/commit):
`git remote add origin git@github.com:plafond/hashDictionary.git`
Initial push (after add/commit and remote add):
`git push -u origin master`
Reset local repo to Head|<branch>
`git reset --hard HEAD`
^^perhaps it is better to `git checkout <filename>`??
`git checkout -f`
Can actually revert a commit!
`git revert HEAD|<branch>`