-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathimpGitThings
83 lines (53 loc) · 2.01 KB
/
impGitThings
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
How to initialise git in the computer:
1. git init
Adding git username and setting up email:
1. git config --global user.name "YOUR_USERNAME"
2. git config --global user.email "your_email_address"
How to check your username and email:
1. git config --global user.name
2. git config --global user.email
1."How to set proxy in git"
git config --global http.proxy 172.16.20.2:3128
2."How to unset git proxy
git config --global --unset http.proxy
3."How to check current git proxy
git config --global --get http.proxy
How to see difference between two commits:
1. git diff commit1 commit2
Steps to commit changes:
1. git showdown (git log --decorate --oneline --all --graph)
2. git add [location of files or folders].
3. git status
4. git commit -m "Description of commit".
Show git Log History in Graph form:
git log --oneline --graph --decorate --all
Steps for branching
For adding branch
1. git branch [branch name]
2. git checkout [branch name]
3. git branch -d [branch name]
Steps for remote:
1. git remote add [remote name] [remote link]
2. git remote remove [remote name]
Steps for pushing, fetching, pulling, merging and rebasing.
1. git push [remote name] [remote branch]
2. git pull [remote name] [remote branch]
3. git fetch [remote name] [remote branch]
4. git merge [remote name]/[remote branch]
5. git rebase [remote name]/[remote branch]
6. git rebase -i [remote name]/[remote branch] //for squashing the commits this is useful, instead of pick write fixup on it but never fixup the first commit
Steps for updating the online branches of a repo:
git fetch [remote name]
Steps for resetting :
for resetting upto a commit ...delete commits till that commit and adds those to staging area
1. git reset --soft <commit>
for resetting every changes made currently:
1. git reset --hard
for resetting the repo to the last commit:
1. git reset --hard HEAD^
for resetting the repo to the last n commits(n is a number):
1. git reset --hard HEAD~3
for updating deleted branch on remote
1. git fetch --prune
or
1. git fetch -p