|
25 | 25 | git config --global user.name
|
26 | 26 | git config --global user.email
|
27 | 27 |
|
28 | | -3. ### Mange Repository |
| 28 | +3. ### Manage Repository |
29 | 29 |
|
30 | 30 | Pocess 1: Create a Repository in git hub/git lab then Clone the Repository
|
31 | 31 |
|
|
46 | 46 | 4. ### Adding files and folder (Workspace --> Staging)
|
47 | 47 |
|
48 | 48 | # Add the specified file from the current directory to the staging.
|
49 | | - $ git add [file1] [file2] ... |
| 49 | + $ git add [file1] [file2] [fileN] |
50 | 50 |
|
51 | 51 | # Add the specified directory from the current directory to the staging, including subdirectories.
|
52 | 52 | $ git add [dir]
|
|
81 | 81 |
|
82 | 82 | 7. ### Commit changes (Workspace <-- Staging <-- Repository )
|
83 | 83 |
|
84 | | - # Redo the last commit. |
| 84 | + # Undo the last commit. |
85 | 85 | $ git reset HEAD~1
|
86 | 86 |
|
| 87 | +8. ### Remote synchronization from Repository(Repository <-- Remotr) |
| 88 | + |
| 89 | + # Undo the last commit. |
| 90 | + $ git reset HEAD~1 |
| 91 | + |
| 92 | + |
87 | 93 | 8. ### Repository synchronization from remote (Repository <-- Remote)
|
88 | 94 |
|
89 | 95 | # Download specific branch.
|
|
92 | 98 | # Download all remote branches.
|
93 | 99 | $ git fetch --all
|
94 | 100 |
|
95 | | -8. ### Workspace synchronization from remote (Workspace <-- Repository <-- Remote) |
| 101 | + |
| 102 | +9. ### Workspace synchronization from Repository (Workspace <-- Repository) |
| 103 | + |
| 104 | + # merge the specified branch to the current branch. |
| 105 | + $ git merge [branch] |
| 106 | + |
| 107 | + # merge a branch into a target branch |
| 108 | + $ git merge [source branch] [target branch] |
| 109 | + |
| 110 | + |
| 111 | +10. ### Workspace synchronization from remote (Workspace <-- Repository <-- Remote) |
96 | 112 |
|
97 | 113 | # Retrieve the changes to the Remote Repository and merge with the local branch.
|
98 | 114 | $ git pull origin [branch]
|
|
103 | 119 | # Push all the branches to the Remote Repository.
|
104 | 120 | $ git push origin --all
|
105 | 121 |
|
| 122 | + |
106 | 123 | 6. ### Remote branch synchronization from local
|
107 | 124 |
|
108 | 125 | # Push the local specified branch to the Remote Repository.
|
|
141 | 158 | # Delete the remote branch.
|
142 | 159 | $ git push origin --delete [branch-name]
|
143 | 160 | $ git branch -dr [remote/branch]
|
144 | | - |
145 | | -6. ### Merging |
146 | | - |
147 | | - # merge the specified branch to the current branch. |
148 | | - $ git merge [branch] |
149 | | - |
150 | | - # merge a branch into a target branch |
151 | | - $ git merge [source branch] [target branch] |
152 | | - |
153 | | - # Select a commit to be merged into the current branch. |
154 | | - $ git cherry-pick [commit] |
155 | 161 |
|
156 | 162 |
|
157 | 163 | 5. ### Ignore files and folder
|
|
298 | 304 | # Generate a archive for releasing.
|
299 | 305 | $ git archive
|
300 | 306 |
|
| 307 | + # Select a commit to be merged into the current branch. |
| 308 | + $ git cherry-pick [commit] |
| 309 | + |
301 | 310 | 9. ### References
|
302 | 311 |
|
303 | 312 | I have followed many articles but among them, the following articles are really helpful. Those articles helped me a lot and also encourage me to write this article according to my understanding.
|
|
0 commit comments