-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgit_command
More file actions
113 lines (68 loc) · 3.48 KB
/
git_command
File metadata and controls
113 lines (68 loc) · 3.48 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
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
108
109
110
git reset --soft HEAD~1
git reset --hard HEAD~1
git commit -m "meassage"
git stash
git branch branch_name
git add
git commit
git push origin hdl
git merge https://www.atlassian.com/git/tutorials/merging-vs-rebasing
git rebase
git cherry-pick https://www.atlassian.com/git/tutorials/cherry-pick
change from https to ssh: https://stackoverflow.com/questions/68775869/support-for-password-authentication-was-removed-please-use-a-personal-access-to
https://statistics.berkeley.edu/computing/faqs/git-auth
git config remote.origin.url git@github.com:ACCOUNT/REPO.git
git remote set-url origin git@github.com:ACCOUNT/REPO.git
git restore filenae
pull another branches
# First add 'E3SM' main repo as a new remote (e3sm)
git remote add e3sm git@github.com:E3SM-Project/E3SM
# Here is the explanation of what the above
# Think of 'origin' and 'e3sm' as pointer. In your case,
# origin was pointing to your repo: git@github.com:daleihao/e3sm
# e3sm now points to git@github.com:E3SM-Project/E3SM
# Now get new stuff from e3sm repo
git fetch e3sm
# Now checkout my branch from e3sm repo
git checkout bishtgautam/lnd/solar_rad_top
# Now update the submodules
git submodule update --init
# Now run the test
cd cime/scripts
./create_test SMS_Lm1.f09_f09.IELM.cori-knl_intel.elm-solar_rad
In running the test suite you do the following:
First, one creates “baselines” for the test suite. The baselines are some netcdf output files. You create the baseline using the hash on master from which you started your development.
Then, one switches to the last hash of their development branch. Runs the test suite and this time compares against the previously generated baseline.
If you didn’t fix a bug, the answers between the two should be bit-for-bit (BFB).
10:42
Here are my notes describing the procedure: https://gist.github.com/bishtgautam/31a73b933e2492698bccfc7b55acf01e
git checkout daleihao/lnd/solar_rad_top
# rebase your branch on top of my branch. this way you will get the new commit i made
git rebase bishtgautam/lnd/solar_rad_top
git push origin daleihao/lnd/solar_rad_top
git fetch e3sm
git checkout bishtgautam/lnd/solar_rad_top_rebased
git reset --hard e3sm/bishtgautam/lnd/solar_rad_top_rebased
git chechkout daleihao/lnd/solar_rad_top_rebased
git reset --hard bishtgautam/lnd/solar_rad_top_rebased
git checkout daleihao/lnd/solar_rad_top
git reset --hard bishtgautam/lnd/solar_rad_top_rebased
git push origin +daleihao/lnd/solar_rad_top
commit one commit from other branch
git cherry-pick 4b85412c0238e0d86cc33d9f6cd6ec88d538a1d3
## git squash
https://levelup.gitconnected.com/how-to-squash-git-commits-9a095c1bc1fc
## remove all local change
git reset --hard HEAD
## (It seems that pull fetches all branches from all remotes, but I always fetch first just to be sure.) Run the first command only if there are remote branches on the server that aren't tracked by your local branches.
git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
f the location (URL) of the submodule has changed, then you can simply:
Modify the .gitmodules file in the repo root to use the new URL.
Delete the submodule folder in the repo rm -rf .git/modules/<submodule>.
Delete the submodule folder in the working directory rm -rf <submodule>.
Run git submodule sync.
Run git submodule update.
More complete info can be found elsewhere:
Changing remote repository for a git submodule