forked from AlexITC/notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git.sh
64 lines (45 loc) · 1.3 KB
/
git.sh
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
# Tricks
https://ohshitgit.com/
# after downloading a project
git config user.name "Alexis Hernandez"
git config user.email "[EMAIL]"
git config pull.rebase true
# use pgp2 for signing work
git config --global gpg.program gpg2
# sign commits by default
git config commit.gpgsign true
# select key for signing
git config user.signingkey KEYID
# delete remote branch
git push origin --delete remote-branch
# sync branches
git remote prune origin --dry-run
# list project developers
git log --format='%aN' | sort -u
# set remote url
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
# print remote url
git remote -v
# see changes in stash
git stash show -p stash@{1}
# see commit diff
git diff [COMMIT]^!
# update date on last commit
git commit --amend --date="$(date -R)"
# sync forked repo
git remote add artik [email protected]:artikcloud/leshan.git
git remote add upstream https://github.com/eclipse/leshan.git
git fetch upstream
git pull upstream master
git push
# change log between tags
git log v2018.01.14..v2018.01.21 --oneline
# submodules
git submodule init
git submodule update --init
# update branches from remote
git fetch --all --prune
# clone single tag
git clone -b '1.22' --single-branch --depth 1 https://github.com/google/leveldb.git
# get current commit hash
git rev-parse HEAD