-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGit_Exercise_Commands.rtf
153 lines (152 loc) · 3.63 KB
/
Git_Exercise_Commands.rtf
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf500
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
\f0\fs24 \cf0 #Commands for git exercise \
1. git init\
vim .gitignore\
git add .\
git commit -v -m \'93Initial commit with files added with gitignore\'94\
\
2. Added some files(either use vim to create / manually created)\
\
3. git status\
git diff\
git add .\
git status\
git commit -v -m \'93This is the first commit with file added File1\'94\
git status\
\
Added another file File2\
git status\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
\cf0 git diff\
git add .\
git status\
git commit -v -m \'93This is the second commit with file added File2\'94\
git status\
\
5. git status GitExeWork/ViewController.swift\
\
6. git reset GitExeWork/ViewController.swift\
\
7. git status\
git diff\
git add .\
git status\
git commit -v -m \'93This commit will be reverted\'94\
git status\
\
8 git revert HEAD\
\
9 git log\
\
10. Git show \'93Commit hash from git log\'94\
\
11. git status\
git branch feature1\
git branch feature2\
git branch -d feature2\
\
12. git checkout feature1\
git status\
//Made some changes\
git status\
git diff\
git add .\
git status\
git commit -v -m \'93Added a method in ViewController\'94\
git status\
\
13. git checkout master\
git status\
// Made changes in same file\
git status\
git diff\
git add .\
git status\
git commit -v -m \'93Added method switch to branch to View controller\'94\
git status\
\
14. Git merge feature1\
//After resolve conflict\
git status\
git commit -v -m \'93This is the git commit after \'93resolving conflict\'94\
git status\
\
15. git branch feature2\
git checkout feature2\
//Made some changes\
git status \
git diff\
git add .\
git status\
git commit -v -m \'93This is first commit feature2\'94\
\
16. git checkout master\
// Made some changes\
git status\
git diff\
git add .\
git status\
git commit -v -m \'93Added this changes after branch feature2 created on master\'94\
git status\
\
17. git rebase feature2\
//After resolving conflict\
git rebase --continue \
git status\
\
18. In merge : After conflict resolve , we have to make commit, it will contain commit history of merging branch in git log\
In rebase: After conflict resolve, we have to continue rebase, it will not contain other branch git commit log after rebase like in merge.\
\
19. Made some changes\
git status\
git stash\
git checkout feature2\
//Made some changes\
git status\
git stash\
git checkout feature1\
//Made some changes\
git status\
git stash\
git checkout master\
git stash list\
git stash apply stash@\{2\}\
git status\
git diff\
git add .\
git status\
git commit -v -m \'93This is commit after applying stash\'94\
git status\
git checkout feature2\
git stash apply stash@\{1\}\
git status\
git diff\
git add .\
git status\
git commit -v -m \'93This is commit after applying stash\'94\
git status\
git checkout feature1\
git stash apply stash@\{0\}\
git status\
git diff\
git add .\
git status\
git commit -v -m \'93This is commit after applying stash\'94\
git status\
\
20. git checkout master\
git remote add origin \'93GitHub repository url\'94\
git push -u origin master\
git checkout feature1\
git push -u origin feature1\
git checkout feature2\
git push -u origin feature2\
\
\
\
}