-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit_cheat.txt
45 lines (24 loc) · 1.07 KB
/
git_cheat.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
git init # creates a .git dir in cwd
git add <file> # ->Staging area
git commit # ->History (includes message)
Branches: a named pointer to a commit
- Default branch: main
- Tag: Fixed named pointer to a commit
git config --global user.name
git config --global user.email
git show # shows the diff from last commit
git log # show all commits
git diff # diff btw cwd and stage
git diff --staged # diff btw stage and last commit
git diff <arg1> <arg2> # in general
git mv #like mv stages automatically
git rm # like rm, stages automatically
git reset <file> Removes changes/files from the staging area
git log # show auth info, data, hash , message
git log <a>..<b> # Range btwn hashes
git log --oneline # more concise view
git log --all --decorate --graph # show branches in "ASCII art"
git shortlog [-sne] # Show no of cmmits per author
git checkout <commit> # load a certain commit from the history
git restore <file> # Restore a file to the v. from last commit (discarding changes)
git restore --source=<source> <file> # Restore file from a specific commit or branch