-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathgit
More file actions
129 lines (105 loc) · 3.07 KB
/
Copy pathgit
File metadata and controls
129 lines (105 loc) · 3.07 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# git
git log --oneline
git log --stat --summary
git log -p # see complete diff at each step
git log --author="<pattern>"
git log --grep="<pattern>"
git pull <remote> == git fetch <remote>; git merge origin/<current-branch>
git clean # removes untracked files from working directory
git tag v2.5 1b2ae37b
git grep "hello" v2.5
git revert HEAD # revert the most recent commit
git reset # unstages all files without overwriting any changes
git reset --soft HEAD~1 # undo last commit without losing changes
git reset --hard # undo last commit AND lose changes.
git reset --hard <commit> # obliterates all commits after <commit>
git reset --hard HEAD~2 # remove last 2 commits
# forgot to add files or to make some changes
git add ./path/to/file
git commit -a --amend -C HEAD
# undo last push
git push -f origin HEAD^:main
# fork on github
- sync
git remote add upstream https://github.com/some/project.git
git fetch upstream
git checkout main
git merge --ff-only upstream/main
- create branch and push changes
git checkout -b fix-blah main
git commit -m Fix... core.py
git push origin fix-blah
- keep forked repo synced with upstream
git checkout main
git fetch upstream
git merge --ff-only upstream/main
git rebase upstream/main
git push origin main
- keep pr on top of upstream
https://www.digitalocean.com/community/tutorials/how-to-rebase-and-update-a-pull-request
- delete branch
git branch -d fix-blah
git push -d origin fix-blah
# main/develop/branches (newfeats/bugfixes/releases) http://nvie.com/posts/a-successful-git-branching-model/
* new feature
1. create branch
git checkout -b newfeat develop
2. incorporate feature on develop
git checkout develop
git merge --no-ff myfeat
git branch -d myfeat
git push origin develop
3. create a release branch
git checkout -b release-1.2 develop
change version number
git commit -a -m 'New release 1.2'
4. finishing a release branch
git checkout main
git merge --no-ff release-1.2
git tag -a 1.2
git checkout develop
git merge --no-ff release-1.2
git branch -d release-1.2
* new hotfix
git checkout -b hotfix-1.2.1 main
change version number
git commit -a -m 'New bugfix version 1.2.1'
fix bug
git commit -m 'Fixed blah bug'
git checkout main
git merge --no-ff hotfix-1.2.1
git tag -a 1.2.1
git checkout develop
git merge --no-ff hotfix-1.2.1
git branch -d hotfix-1.2.1
# stash
git stash list
git stash apply stash@{2}
git stash show
# making changes to pull request
git fetch https://github.com/asolino/patator main
git checkout FETCH_HEAD
make changes
git add patator.py
git commit -a
git checkout main
git merge <commitid of my commit above>
git push
# skiddit
git checkout -b release-0.3 main
change version number
git commit -a -m 'New release 0.3'
git checkout main
git merge --no-ff release-0.3
git tag -a 0.3
enter release-0.3
git branch -d release-0.3
git push origin --tags
git push
# cat all objects to grep for flag
for i in .git/objects/*/*; do j=${i#.git/objects/}; j=$(echo $j | tr -d /); echo $j; git cat-file -p $j; done | grep flag
# rip .git
http://www.slideshare.net/kost/ripping-web-accessible-git-files
tools/exploit/dvcs-rippers
# gui
gitk, qgit, tig