@@ -11,6 +11,25 @@ From scratch -- Set your name associated with your user account
1111<br >
1212Set your email associated with your user account
1313``` git config --global user.email "youremail@abc.com" ```
14+ <br >
15+ Set your default editor
16+ ``` git config --global core.editor "vim" ```
17+ <br >
18+ Set your default merge tool
19+ ``` git config --global merge.tool "vimdiff" ```
20+ <br >
21+ Set your default push behavior
22+ ``` git config --global push.default "simple" ```
23+ <br >
24+ Set your default pull behavior
25+ ``` git config --global pull.rebase "true" ```
26+ <br >
27+ Set your default branch name
28+ ``` git config --global init.defaultBranch "main" ```
29+ <br >
30+ Set your default credential helper
31+ ``` git config --global credential.helper "cache --timeout=3600" ```
32+ <br >
1433
1534### 🛠 Create a Repository
1635
@@ -47,6 +66,10 @@ Show full change history
4766Show the change history for file/directory including diffs
4867``` git log -p [file/directory] ```
4968<br >
69+ Show the change history for a specific author
70+ ``` git log --author="[author name]" ```
71+ <br >
72+
5073### 🌴 Working with Branches
5174List all local branches
5275``` git branch ```
@@ -162,10 +185,50 @@ Undo local modifications to all files
162185Unstages a file
163186``` git reset HEAD myfile ```
164187<br >
188+ Undo local modifications to a file and stage it
189+ ``` git checkout -- myfile ```
190+ ``` git add myfile ```
191+ <br >
192+ Find the commit that introduced a bug
193+ ``` git bisect start ```
194+ ``` git bisect bad ```
195+ ``` git bisect good <commit> ```
196+ <br >
197+
198+ ### 📦 Submodules
199+
200+ Add a submodule
201+ ``` git submodule add <url> ```
202+ <br >
203+ Update a submodule
204+ ``` git submodule update --remote ```
205+ <br >
206+ Remove a submodule
207+ ``` git submodule deinit -f -- submodule_name ```
208+ ``` git rm -f submodule_name ```
209+ ``` git rm -f .gitmodules ```
210+ <br >
211+ ### 📦 Subtrees
212+
213+ Add a subtree
214+ ``` git subtree add --prefix=folder_name <url> ```
215+ <br >
216+ Update a subtree
217+ ``` git subtree pull --prefix=folder_name <url> ```
218+ <br >
219+ Remove a subtree
220+ ``` git subtree split --prefix=folder_name ```
221+ ``` git rm -rf folder_name ```
222+ ``` git commit -m "Remove folder_name" ```
223+ <br >
224+
165225### 🗣Help
166- When in doubt, use git help
167- ``` git command --help ```
168- <br ><br >
226+
227+ ``` git help -a ``` and ``` git help -g ``` list available subcommands and some
228+ concept guides. See ``` git help <command> ``` or ``` git help <concept> ```
229+ to read about a specific subcommand or concept.
230+ See ``` git help git ``` for an overview of the system.
231+ <br >
169232
170233## Git Resources
171234You should check some of these Git resources as they would be amazing for your journey.
0 commit comments