Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f1ea4cb

Browse files
Update README.md
1 parent d9f52e4 commit f1ea4cb

File tree

1 file changed

+140
-140
lines changed

1 file changed

+140
-140
lines changed

‎README.md

Lines changed: 140 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ Though there are 1000’s of articles about git, I have written this article is
1818

1919
Git config that lets you get and set configuration variables that control all aspects of how Git looks and operates.
2020

21-
# Display the current Git configuration.
22-
$ git config --list
23-
24-
# Set the user information when submitting code.
25-
git config --global user.name "Saiful Islam"
26-
git config --global user.email "saifaustcse26@gmail.com"
27-
28-
# Check
29-
git config --global user.name
30-
git config --global user.email
31-
21+
# Display the current Git configuration.
22+
$ git config --list
23+
24+
# Set the user information when submitting code.
25+
git config --global user.name "Saiful Islam"
26+
git config --global user.email "saifaustcse26@gmail.com"
27+
28+
# Check
29+
git config --global user.name
30+
git config --global user.email
31+
3232

3333
### Manage Repository
3434

@@ -40,146 +40,146 @@ Though there are 1000’s of articles about git, I have written this article is
4040

4141
Pocess 2: Create a Repository in local machine then add repository in git hub/git
4242

43-
1- $ cd to your Project
44-
2- $ git init
45-
3- $ git add --all or git add .
46-
4- $ git commit -m "first commit"
47-
5- $ git remote add origin github.com/saifaustcse/new_repository
48-
6- $ git push -u origin master
43+
1- $ cd to your Project
44+
2- $ git init
45+
3- $ git add --all or git add .
46+
4- $ git commit -m "first commit"
47+
5- $ git remote add origin github.com/saifaustcse/new_repository
48+
6- $ git push -u origin master
4949

5050

5151
### Adding files and folder (Workspace --> Staging)
5252

53-
# Add the specified file from the current directory to the staging.
54-
$ git add [file1] [file2] [fileN]
53+
# Add the specified file from the current directory to the staging.
54+
$ git add [file1] [file2] [fileN]
5555

56-
# Add the specified directory from the current directory to the staging, including subdirectories.
57-
$ git add [dir]
56+
# Add the specified directory from the current directory to the staging, including subdirectories.
57+
$ git add [dir]
5858

59-
# Add all files (tracked or untracked) from the current directory to the staging.
60-
$ git add .
59+
# Add all files (tracked or untracked) from the current directory to the staging.
60+
$ git add .
6161

62-
# If unwanted files were added to the staging area but not yet committed.
63-
$ git reset HEAD .
64-
$ git reset HEAD [file_name]
62+
# If unwanted files were added to the staging area but not yet committed.
63+
$ git reset HEAD .
64+
$ git reset HEAD [file_name]
6565

6666

6767
### Commit changes (Staging --> Repository)
6868

69-
# Submit the code from the staging to the Repository with a message
70-
$ git commit -m [message]
71-
72-
# Submit the specified file from the staging to the Repository.
73-
$ git commit [file1] [file2] [fileN] -m [message]
69+
# Submit the code from the staging to the Repository with a message
70+
$ git commit -m [message]
71+
72+
# Submit the specified file from the staging to the Repository.
73+
$ git commit [file1] [file2] [fileN] -m [message]
74+
75+
# Display all diff information when submitting.
76+
$ git commit -v
7477

75-
# Display all diff information when submitting.
76-
$ git commit -v
77-
7878

7979
### Commit changes (Workspace --> Staging --> Repository)
8080

81-
# Submit the changes of all tracked files after the last commit.
82-
$ git commit -am [message]
81+
# Submit the changes of all tracked files after the last commit.
82+
$ git commit -am [message]
8383

84-
# For untracked file
85-
$ git add .
86-
$ git commit -am [message]
84+
# For untracked file
85+
$ git add .
86+
$ git commit -am [message]
8787
8888

8989
### Undo Commit (Workspace <-- Staging <-- Repository )
9090

91-
# Undo the last commit.
92-
$ git reset HEAD~1
91+
# Undo the last commit.
92+
$ git reset HEAD~1
9393

9494
### Remote synchronization from Repository(Repository --> Remote)
9595

96-
# Push the current branch to the Remote Repository.
97-
$ git push origin [branch]
96+
# Push the current branch to the Remote Repository.
97+
$ git push origin [branch]
9898

9999

100100
### Repository synchronization from remote (Repository <-- Remote)
101101

102-
# Download specific branch.
103-
$ git fetch origin [branch]
102+
# Download specific branch.
103+
$ git fetch origin [branch]
104104

105-
# Download all remote branches.
106-
$ git fetch --all
105+
# Download all remote branches.
106+
$ git fetch --all
107107

108108

109109
### Workspace synchronization from Repository (Workspace <-- Repository)
110110

111-
# merge the specified branch to the current branch.
112-
$ git merge [branch]
111+
# merge the specified branch to the current branch.
112+
$ git merge [branch]
113113

114-
# merge a branch into a target branch
115-
$ git merge [source branch] [target branch]
114+
# merge a branch into a target branch
115+
$ git merge [source branch] [target branch]
116116
117117

118118
### Workspace synchronization from remote (Workspace <-- Repository <-- Remote)
119119

120-
# Retrieve the changes to the Remote Repository and merge with the local branch (fetch+merge)
121-
$ git pull origin [branch]
122-
120+
# Retrieve the changes to the Remote Repository and merge with the local branch (fetch+merge)
121+
$ git pull origin [branch]
122+
123123

124124
### Branching
125125

126-
# List all local branches. (the asterisk denotes the current branch)
127-
$ git branch
126+
# List all local branches. (the asterisk denotes the current branch)
127+
$ git branch
128128

129-
# List all remote branches.
130-
$ git branch -r
129+
# List all remote branches.
130+
$ git branch -r
131131

132-
# List all local branches and remote branches.
133-
$ git branch -a
132+
# List all local branches and remote branches.
133+
$ git branch -a
134134

135-
# Create a new branch, but still stay in the current branch.
136-
$ git branch [branch-name]
135+
# Create a new branch, but still stay in the current branch.
136+
$ git branch [branch-name]
137137

138-
# Create a new branch and switch to the branch.
139-
$ git checkout -b [branch]
138+
# Create a new branch and switch to the branch.
139+
$ git checkout -b [branch]
140140

141-
# Switch to the specified branch and update the workspace.
142-
$ git checkout [branch-name]
141+
# Switch to the specified branch and update the workspace.
142+
$ git checkout [branch-name]
143143

144-
# Switch to the previous branch.
145-
$ git checkout -
144+
# Switch to the previous branch.
145+
$ git checkout -
146146

147-
# Delete the branch.
148-
$ git branch -d [branch-name]
147+
# Delete the branch.
148+
$ git branch -d [branch-name]
149149

150-
# Delete the remote branch.
151-
$ git push origin --delete [branch-name]
152-
$ git branch -dr [remote/branch]
150+
# Delete the remote branch.
151+
$ git push origin --delete [branch-name]
152+
$ git branch -dr [remote/branch]
153153
154154

155155
### Inspection
156156

157-
# Display the changed files.
158-
$ git status
157+
# Display the changed files.
158+
$ git status
159159

160-
# Display the version history of the current branch.
161-
$ git log
160+
# Display the version history of the current branch.
161+
$ git log
162162

163-
# Display all commits (Custom Filtering)
164-
$ git log --all
163+
# Display all commits (Custom Filtering)
164+
$ git log --all
165165

166-
# Display the 5 most recent commits (Custom Filtering)
167-
$ git log -5
166+
# Display the 5 most recent commits (Custom Filtering)
167+
$ git log -5
168168

169-
# View Commit History in ASCII Graph
170-
$ git log --graph
171-
172-
# Display Just One Line Per Commit
173-
$ git log --oneline
169+
# View Commit History in ASCII Graph
170+
$ git log --graph
171+
172+
# Display Just One Line Per Commit
173+
$ git log --oneline
174174

175-
# Display Just One Line Per Commit with message (Custom Formatting)
176-
$ git log --pretty=oneline
175+
# Display Just One Line Per Commit with message (Custom Formatting)
176+
$ git log --pretty=oneline
177177

178-
# Display all the users who have committed, sorted by number of commits.
179-
$ git shortlog -sn
178+
# Display all the users who have committed, sorted by number of commits.
179+
$ git shortlog -sn
180180

181-
# Show the latest commits of the current branch.
182-
$ git reflog
181+
# Show the latest commits of the current branch.
182+
$ git reflog
183183

184184
For more details:
185185

@@ -191,86 +191,86 @@ Though there are 1000’s of articles about git, I have written this article is
191191

192192
### Revoke
193193

194-
# Restore the specified file of the Staging to the Workspace.
195-
$ git checkout [file]
194+
# Restore the specified file of the Staging to the Workspace.
195+
$ git checkout [file]
196196

197-
# Restore the specified file of a certain commit to the Staging and Workspace.
198-
$ git checkout [commit] [file]
197+
# Restore the specified file of a certain commit to the Staging and Workspace.
198+
$ git checkout [commit] [file]
199199

200-
# Restore all the files in the Staging to the Workspace.
201-
$ git checkout .
200+
# Restore all the files in the Staging to the Workspace.
201+
$ git checkout .
202202

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

206-
# Reset the Staging and workspace, keeping consistent with the last commit.
207-
$ git reset --hard
206+
# Reset the Staging and workspace, keeping consistent with the last commit.
207+
$ git reset --hard
208208

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

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

215-
# Reset the current HEAD to the specified commit, remaining the Staging and Workspace unchanged.
216-
$ git reset --keep [commit]
215+
# Reset the current HEAD to the specified commit, remaining the Staging and Workspace unchanged.
216+
$ git reset --keep [commit]
217217

218-
# Create a new commit to undo the specified commit.
219-
# All changes of the latter will be offset by the former and applied to the current branch.
220-
$ git revert [commit]
218+
# Create a new commit to undo the specified commit.
219+
# All changes of the latter will be offset by the former and applied to the current branch.
220+
$ git revert [commit]
221221

222-
# Remove the uncommitted changes temporarily and move them in later.
223-
$ git stash
224-
$ git stash pop
222+
# Remove the uncommitted changes temporarily and move them in later.
223+
$ git stash
224+
$ git stash pop
225225
226226

227227
### Ignore files and folder
228228

229-
# Delete the files in the Workspace and put this deletion into the Staging.
230-
$ git rm [file1] [file2] ...
229+
# Delete the files in the Workspace and put this deletion into the Staging.
230+
$ git rm [file1] [file2] ...
231231

232-
# Stop tracking the specified file, but the file will be remained in the Workspace.
233-
$ git rm --cached [file]
232+
# Stop tracking the specified file, but the file will be remained in the Workspace.
233+
$ git rm --cached [file]
234234
235235

236236
### Tag
237237

238-
# List all tags.
239-
$ git tag
238+
# List all tags.
239+
$ git tag
240240

241-
# Create a new tag in the current commit.
242-
$ git tag [tag]
241+
# Create a new tag in the current commit.
242+
$ git tag [tag]
243243

244-
# Create a new tag in the specified commit.
245-
$ git tag [tag] [commit]
244+
# Create a new tag in the specified commit.
245+
$ git tag [tag] [commit]
246246

247-
# Delete the local tag.
248-
$ git tag -d [tag]
247+
# Delete the local tag.
248+
$ git tag -d [tag]
249249

250-
# Delete the remote tag.
251-
$ git push origin :refs/tags/[tagName]
250+
# Delete the remote tag.
251+
$ git push origin :refs/tags/[tagName]
252252

253-
# View the tag information.
254-
$ git show [tag]
253+
# View the tag information.
254+
$ git show [tag]
255255

256-
# Commit the specified tag.
257-
$ git push [remote] [tag]
256+
# Commit the specified tag.
257+
$ git push [remote] [tag]
258258

259-
# Commit all tags.
260-
$ git push [remote] --tags
259+
# Commit all tags.
260+
$ git push [remote] --tags
261261

262-
# Create a new branch pointing to a certain tag
263-
$ git checkout -b [branch] [tag]
262+
# Create a new branch pointing to a certain tag
263+
$ git checkout -b [branch] [tag]
264264

265265

266266

267267
### Others
268268

269-
# Select a commit to be merged into the current branch.
270-
$ git cherry-pick [commit]
269+
# Select a commit to be merged into the current branch.
270+
$ git cherry-pick [commit]
271271

272-
# Generate a archive for releasing.
273-
$ git archive
272+
# Generate a archive for releasing.
273+
$ git archive
274274

275275
### Merging vs. Rebasing
276276

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /