@@ -47,7 +47,6 @@ Though there are 1000’s of articles about git, I have written this article is
47
47
5- $ git remote add origin github.com/saifaustcse/new_repository
48
48
6- $ git push -u origin master
49
49
50
-
51
50
### Adding files and folder (Workspace --> Staging)
52
51
53
52
# Add the specified file from the current directory to the staging.
@@ -63,7 +62,6 @@ Though there are 1000’s of articles about git, I have written this article is
63
62
$ git reset HEAD .
64
63
$ git reset HEAD [file_name]
65
64
66
-
67
65
### Commit changes (Staging --> Repository)
68
66
69
67
# Submit the code from the staging to the Repository with a message
@@ -75,7 +73,6 @@ Though there are 1000’s of articles about git, I have written this article is
75
73
# Display all diff information when submitting.
76
74
$ git commit -v
77
75
78
-
79
76
### Commit changes (Workspace --> Staging --> Repository)
80
77
81
78
# Submit the changes of all tracked files after the last commit.
@@ -84,19 +81,12 @@ Though there are 1000’s of articles about git, I have written this article is
84
81
# For untracked file
85
82
$ git add .
86
83
$ git commit -am [message]
87
-
88
-
89
- ### Undo Commit (Workspace <-- Staging <-- Repository )
90
-
91
- # Undo the last commit.
92
- $ git reset HEAD~1
93
84
94
85
### Remote synchronization from Repository(Repository --> Remote)
95
86
96
87
# Push the current branch to the Remote Repository.
97
88
$ git push origin [branch]
98
89
99
-
100
90
### Repository synchronization from remote (Repository <-- Remote)
101
91
102
92
# Download specific branch.
@@ -105,7 +95,6 @@ Though there are 1000’s of articles about git, I have written this article is
105
95
# Download all remote branches.
106
96
$ git fetch --all
107
97
108
-
109
98
### Workspace synchronization from Repository (Workspace <-- Repository)
110
99
111
100
# merge the specified branch to the current branch.
@@ -114,13 +103,11 @@ Though there are 1000’s of articles about git, I have written this article is
114
103
# merge a branch into a target branch
115
104
$ git merge [source branch] [target branch]
116
105
117
-
118
106
### Workspace synchronization from remote (Workspace <-- Repository <-- Remote)
119
107
120
108
# Retrieve the changes to the Remote Repository and merge with the local branch (fetch+merge)
121
109
$ git pull origin [branch]
122
110
123
-
124
111
### Branching
125
112
126
113
# List all local branches. (the asterisk denotes the current branch)
@@ -151,7 +138,6 @@ Though there are 1000’s of articles about git, I have written this article is
151
138
$ git push origin --delete [branch-name]
152
139
$ git branch -dr [remote/branch]
153
140
154
-
155
141
### Inspection
156
142
157
143
# Display the changed files.
@@ -187,19 +173,23 @@ Though there are 1000’s of articles about git, I have written this article is
187
173
* [ Atlassian] ( https://www.atlassian.com/git/tutorials/git-log )
188
174
* [ Thegeekstuff] ( https://www.thegeekstuff.com/2014/04/git-log/ )
189
175
190
-
191
176
192
- ### Revoke
177
+ ### Revoke/Undo from Workspace
193
178
194
- # Restore the specified file of the Staging to the Workspace.
179
+ # Restore the specified file of the Workspace.
195
180
$ git checkout [file]
196
181
197
- # Restore the specified file of a certain commit to the Staging and Workspace.
198
- $ git checkout [commit] [file]
199
-
200
- # Restore all the files in the Staging to the Workspace.
182
+ # Restore all the files of the Workspace.
201
183
$ git checkout .
202
184
185
+
186
+ ### Undo Commit (Workspace <-- Staging <-- Repository )
187
+
188
+ # Undo the last commit.
189
+ $ git reset HEAD~1
190
+
191
+ ### Revoke/Undo from Staging (Workspace <-- Staging)
192
+
203
193
# Reset the specified file in the Staging, keeping consistent with the previous commit, but remaining the workspace unchanged.
204
194
$ git reset [file]
205
195
@@ -221,8 +211,7 @@ Though there are 1000’s of articles about git, I have written this article is
221
211
222
212
# Remove the uncommitted changes temporarily and move them in later.
223
213
$ git stash
224
- $ git stash pop
225
-
214
+ $ git stash pop
226
215
227
216
### Ignore files and folder
228
217
0 commit comments