Skip to content

Commit 31a6f10

Browse files
authored
Update README.md
1 parent d2dfbee commit 31a6f10

File tree

1 file changed

+84
-84
lines changed

1 file changed

+84
-84
lines changed

README.md

+84-84
Original file line numberDiff line numberDiff line change
@@ -105,145 +105,145 @@ Though there are 1000’s of articles about git, I have written this article is
105105

106106
10. ### Workspace synchronization from Repository (Workspace <-- Repository)
107107

108-
# merge the specified branch to the current branch.
109-
$ git merge [branch]
108+
# merge the specified branch to the current branch.
109+
$ git merge [branch]
110110

111-
# merge a branch into a target branch
112-
$ git merge [source branch] [target branch]
111+
# merge a branch into a target branch
112+
$ git merge [source branch] [target branch]
113113

114114
11. ### Workspace synchronization from remote (Workspace <-- Repository <-- Remote)
115115

116-
# Retrieve the changes to the Remote Repository and merge with the local branch (fetch+merge)
117-
$ git pull origin [branch]
116+
# Retrieve the changes to the Remote Repository and merge with the local branch (fetch+merge)
117+
$ git pull origin [branch]
118118

119119
12. ### Branching
120120

121-
# List all local branches. (the asterisk denotes the current branch)
122-
$ git branch
121+
# List all local branches. (the asterisk denotes the current branch)
122+
$ git branch
123123

124-
# List all remote branches.
125-
$ git branch -r
124+
# List all remote branches.
125+
$ git branch -r
126126

127-
# List all local branches and remote branches.
128-
$ git branch -a
127+
# List all local branches and remote branches.
128+
$ git branch -a
129129

130-
# Create a new branch, but still stay in the current branch.
131-
$ git branch [branch-name]
130+
# Create a new branch, but still stay in the current branch.
131+
$ git branch [branch-name]
132132

133-
# Create a new branch and switch to the branch.
134-
$ git checkout -b [branch]
133+
# Create a new branch and switch to the branch.
134+
$ git checkout -b [branch]
135135

136-
# Switch to the specified branch and update the workspace.
137-
$ git checkout [branch-name]
136+
# Switch to the specified branch and update the workspace.
137+
$ git checkout [branch-name]
138138

139-
# Switch to the previous branch.
140-
$ git checkout -
139+
# Switch to the previous branch.
140+
$ git checkout -
141141

142-
# Delete the branch.
143-
$ git branch -d [branch-name]
142+
# Delete the branch.
143+
$ git branch -d [branch-name]
144144

145-
# Delete the remote branch.
146-
$ git push origin --delete [branch-name]
147-
$ git branch -dr [remote/branch]
145+
# Delete the remote branch.
146+
$ git push origin --delete [branch-name]
147+
$ git branch -dr [remote/branch]
148148

149149
13. ### View Information
150150

151-
# Display the changed files.
152-
$ git status
151+
# Display the changed files.
152+
$ git status
153153

154-
# Display the version history of the current branch.
155-
$ git log
154+
# Display the version history of the current branch.
155+
$ git log
156156

157-
# Display the past 5 commits.
158-
$ git log -5 --pretty --oneline
157+
# Display the past 5 commits.
158+
$ git log -5 --pretty --oneline
159159

160-
# Display all the users who have committed, sorted by number of commits.
161-
$ git shortlog -sn
160+
# Display all the users who have committed, sorted by number of commits.
161+
$ git shortlog -sn
162162

163-
# Show the latest commits of the current branch.
164-
$ git reflog
163+
# Show the latest commits of the current branch.
164+
$ git reflog
165165

166166
14. ### Ignore files and folder
167167

168-
# Delete the files in the Workspace and put this deletion into the Staging.
169-
$ git rm [file1] [file2] ...
168+
# Delete the files in the Workspace and put this deletion into the Staging.
169+
$ git rm [file1] [file2] ...
170170

171171

172-
# Stop tracking the specified file, but the file will be remained in the Workspace.
173-
$ git rm --cached [file]
172+
# Stop tracking the specified file, but the file will be remained in the Workspace.
173+
$ git rm --cached [file]
174174

175175
15. ### Tag
176176

177-
# List all tags.
178-
$ git tag
177+
# List all tags.
178+
$ git tag
179179

180-
# Create a new tag in the current commit.
181-
$ git tag [tag]
180+
# Create a new tag in the current commit.
181+
$ git tag [tag]
182182

183-
# Create a new tag in the specified commit.
184-
$ git tag [tag] [commit]
183+
# Create a new tag in the specified commit.
184+
$ git tag [tag] [commit]
185185

186-
# Delete the local tag.
187-
$ git tag -d [tag]
186+
# Delete the local tag.
187+
$ git tag -d [tag]
188188

189-
# Delete the remote tag.
190-
$ git push origin :refs/tags/[tagName]
189+
# Delete the remote tag.
190+
$ git push origin :refs/tags/[tagName]
191191

192-
# View the tag information.
193-
$ git show [tag]
192+
# View the tag information.
193+
$ git show [tag]
194194

195-
# Commit the specified tag.
196-
$ git push [remote] [tag]
195+
# Commit the specified tag.
196+
$ git push [remote] [tag]
197197

198-
# Commit all tags.
199-
$ git push [remote] --tags
198+
# Commit all tags.
199+
$ git push [remote] --tags
200200

201-
# Create a new branch pointing to a certain tag
202-
$ git checkout -b [branch] [tag]
201+
# Create a new branch pointing to a certain tag
202+
$ git checkout -b [branch] [tag]
203203

204204

205205
16. ### Revoke
206206

207-
# Restore the specified file of the Staging to the Workspace.
208-
$ git checkout [file]
207+
# Restore the specified file of the Staging to the Workspace.
208+
$ git checkout [file]
209209

210-
# Restore the specified file of a certain commit to the Staging and Workspace.
211-
$ git checkout [commit] [file]
210+
# Restore the specified file of a certain commit to the Staging and Workspace.
211+
$ git checkout [commit] [file]
212212

213-
# Restore all the files in the Staging to the Workspace.
214-
$ git checkout .
213+
# Restore all the files in the Staging to the Workspace.
214+
$ git checkout .
215215

216-
# Reset the specified file in the Staging, keeping consistent with the previous commit, but remaining the workspace unchanged.
217-
$ git reset [file]
216+
# Reset the specified file in the Staging, keeping consistent with the previous commit, but remaining the workspace unchanged.
217+
$ git reset [file]
218218

219-
# Reset the Staging and workspace, keeping consistent with the last commit.
220-
$ git reset --hard
219+
# Reset the Staging and workspace, keeping consistent with the last commit.
220+
$ git reset --hard
221221

222-
# Reset the pointer of the current branch to pointing the specified commit while resetting the Staging, but the workspace remains unchanged.
223-
$ git reset [commit]
222+
# Reset the pointer of the current branch to pointing the specified commit while resetting the Staging, but the workspace remains unchanged.
223+
$ git reset [commit]
224224

225-
# Reset the HEAD of the current branch to the specified commit while resetting the Staging and Workspace, keeping consistent with the specified commit.
226-
$ git reset --hard [commit]
225+
# Reset the HEAD of the current branch to the specified commit while resetting the Staging and Workspace, keeping consistent with the specified commit.
226+
$ git reset --hard [commit]
227227

228-
# Reset the current HEAD to the specified commit, remaining the Staging and Workspace unchanged.
229-
$ git reset --keep [commit]
228+
# Reset the current HEAD to the specified commit, remaining the Staging and Workspace unchanged.
229+
$ git reset --keep [commit]
230230

231-
# Create a new commit to undo the specified commit.
232-
# All changes of the latter will be offset by the former and applied to the current branch.
233-
$ git revert [commit]
231+
# Create a new commit to undo the specified commit.
232+
# All changes of the latter will be offset by the former and applied to the current branch.
233+
$ git revert [commit]
234234

235-
# Remove the uncommitted changes temporarily and move them in later.
236-
$ git stash
237-
$ git stash pop
235+
# Remove the uncommitted changes temporarily and move them in later.
236+
$ git stash
237+
$ git stash pop
238238

239239

240240
17. ### Others
241241

242-
# Select a commit to be merged into the current branch.
243-
$ git cherry-pick [commit]
242+
# Select a commit to be merged into the current branch.
243+
$ git cherry-pick [commit]
244244

245-
# Generate a archive for releasing.
246-
$ git archive
245+
# Generate a archive for releasing.
246+
$ git archive
247247

248248
18. ### References
249249

@@ -253,5 +253,5 @@ Though there are 1000’s of articles about git, I have written this article is
253253
* [Atlassian](https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html)
254254
* [Git-most-frequently-used-commands](https://medium.com/analytics-vidhya/git-most-frequently-used-commands-9df9f200c235)
255255
* [Ercankaracelik](https://ercankaracelik.wordpress.com/2018/12/08/basic-git-commands/)
256-
* [Tutorialdocs](hhttps://www.tutorialdocs.com/article/git-basic-command-list.html)
256+
* [Tutorialdocs](https://www.tutorialdocs.com/article/git-basic-command-list.html)
257257

0 commit comments

Comments
 (0)