git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git [2024/10/12 19:16] mguptongit [2026/03/31 20:43] (current) mgupton
Line 1: Line 1:
-======Git======+======git======
 A general guide for the distributed version control system Git. A general guide for the distributed version control system Git.
  
 +  * [[git init]]
   * {{ :wiki:git-cheatsheet-en-dark.pdf | Git cheatsheet}}   * {{ :wiki:git-cheatsheet-en-dark.pdf | Git cheatsheet}}
  
Line 11: Line 12:
 git config --global user.email your@email.com git config --global user.email your@email.com
 git config --global core.excludesFile ~/.gitignore git config --global core.excludesFile ~/.gitignore
 +git config --global init.defaultBranch main
 </code> </code>
  
Line 121: Line 123:
  
 ====== Branches ====== ====== Branches ======
 +  * Checkout the branch the new branch is based on
 +  * Then create branch
 +<code bash>
 +git branch <new branch name>
 +</code>
 +  * Create a ranch and check it out in one command
 <code bash> <code bash>
 git checkout -b <new branch name> git checkout -b <new branch name>
Line 126: Line 134:
  
 === Deleting Branches === === Deleting Branches ===
 +  * Delete remote branch, if it exists
 +  * Then delete the local branch
 +<code bash>
 +git push -d <remote_name> <branch name>
 +git branch -d <branch name>
 +</code>
 +
 +To force delete an unmerged branch
 <code bash> <code bash>
-git push -<remote_name> <branchname> +git branch -<branch name>
-git branch -d <branchname>+
 </code> </code>
  
  • git.1728760589.txt.gz
  • Last modified: 2024/10/12 19:16
  • by mgupton