-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit.txt
More file actions
64 lines (50 loc) · 1.24 KB
/
git.txt
File metadata and controls
64 lines (50 loc) · 1.24 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
64
git init
git status
git add
git add .
git commit
git commit -a -m "my third commit"
git commit -m "first commit"
git branch -M main
ssh-keygen -o { For adding SSH keys }
ls -a
git log
git diff
git diff --staged
git rm --cached file2.txt
git status
git push origin main
git push -u origin main
git tag (Annotated Tagging, Lightweight Tagging )
git tag -a v1.0 -m "1st release"
git tag v1.1 -m "27th June release"
git show v1.0
git push origin v1.0
git checkout -b feature1 ( To create a new branch )
git switch main
git switch feature1
git push origin feature1
git switch -c feature2
git branch
git switch feature2
git merge feature1
///////////////////////////
ADVANCED
git fetch origin (to fetch all track history)
git diff origin/master
git checkout [branch name] --orphan
git rebase [source branch] [target branch]
git rebase -i [commit hash]^
git pull origin [source branch] --rebase
git pull origin [source branch] --rebase --autostash
git cherry -pick [commit hash]
git config branch.[branch name].rebase true
git log --pretty=online
git reset --hard origin/[target branch]
git reset --soft HEAD~1
git commit --amend
git revert HEAD~1
git reflog
git bisect start
git branch --merged | egrep -v "(*|master|dev)" | xargs git branch -d
git clean -df