-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgit
107 lines (90 loc) · 3.43 KB
/
git
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// forcet git pull, reset local branch from remote
git fetch --all
git reset --hard origin/master
// workbranch rebase to master
git checkout workbranch
// git merge the commits from #num into 1
git reset --soft #num
git commit -m "<the merged descripition>"
git push -f
git rebase master workbranch // master's new changes to bottom of workbranch
git rebase workbranch master // move head of master to top of workbranch
// add tag
git tag -l
git tag -a release_12_0_6 -m "release version 12.0.6"
git push origin release_12_0_6
git ls-remote --tags origin // see remote tags
git push --delete origin tagname
git tag --delete tagname
// checkout tag
git checkout tags/<tag_name> -b <branch_name>
eg. git checkout tags/llvmorg-13.0.0 -b llvmorg-13.0.0
// clone specific branch 13.x
git clone -b <branch> <repo>
e.g. git clone -b 13.x https://github.com/llvm/llvm-project.git
// checkout specific tag llvmorg-13.0.0
git clone -b <tag> <repo>
e.g. git clone -b llvmorg-13.0.0 https://github.com/llvm/llvm-project.git
// ref. https://www.jiyik.com/w/git/git-clone
// Biren steps
// on master branch
git remote add dev [email protected]:e00241/llvm-project.git
git remote -v // see attached remote repo
git fetch dev
git fetch origin // get the latest origin/master HEAD
git checkout issue#
// after work on the issue# branch
git add; git commit; -> trigger clang-format installed in ~/git/llvm-project/.git/hooks/pre-commit, http://10.50.16.70:8090/display/SOF/tools, (please merge commit into single one commit)
git rebase origin/master
git push dev // push to dev/issue#
// go to https://github01.birentech.com/software/llvm-project/ and create merge request
// after CTS-verification and approve, select squash-merge or rebase-merge botton and click the botton, then it merges into origin/master
// git Subject's rules
https://chris.beams.io/posts/git-commit/
The seven rules of a great Git commit message
Separate subject from body with a blank line
Limit the subject line to 50 characters
Capitalize the subject line
Do not end the subject line with a period
Use the imperative mood in the subject line
Wrap the body at 72 characters
Use the body to explain what and why vs. how
// get someone's Pull Request
// in master of orgin branch
git pull origin pull/732/head
Delete remote first, then local
// delete remote branch
git push origin --delete <branch>
ex. git push origin --delete jonathan_fix_bug_a
// To update the local list of remote branches
git remote update origin --prune
// delete local branch
git branch -D <branch>
// attach dev branch
git remote add dev [email protected]:e00241/llvm-project.git
git remote -v // see attached remote repo
git fetch dev
// checkout remote dev e00241 branch
git checkout -b e00241 origin/e00241
// push to dev
git push dev
// create local new branch
git checkout -b <branch>
// create remote branch
git push --set-upstream origin <branch>
// git merge the last 4 commits into 1
git reset --soft HEAD~4
git commit -m "<the merged descripition>"
git push dev e00241
// check email
git config --global user.email
// set email
git config --global user.email "email address"
// set config
vi .git/config
or git config user.email "[email protected]"
// setup new repository
https://www.atlassian.com/git/tutorials/setting-up-a-repository
// set Linux machine for git user/email for Phoenix before checkout Phoenix
git config --global user.email jonathanchen
git config --global user.email [email protected]