User Tools

Site Tools


git

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
git [2020/10/31 09:35] – [Examples] guide tag rjtgit [2022/03/03 22:58] (current) – Typo, link rjt
Line 1: Line 1:
 ====== Git ====== ====== Git ======
 +
 +===== Commands =====
 +==== Rename Branch ====
 +
 +In my examples I'm replacing branches called 'master' with ones called 'main'.
 +
 +  - Make sure your local and remote repos are up to date.
 +  - ''git branch -m master main'' to move all your stuff, including history, over to the new branch.
 +  - ''git push -u origin main'' to send it to the remote
 +  - Next you need to change what is set as the default. Dunno how to do this with just Git, but with [[Gitea]] (and [[Github]]) you can just do this in the web interface (settings > branches ...).
 +  - To delete the old branches you're not going to use anymore:
 +    * If you're using something like [[Gitea]] or [[Github]]:
 +      * You can delete the old branch from their UI, from the 'branches' tab.
 +      * Then use ''git fetch --prune'' to delete anything locally that's not on the remote (if that's safe in your case).
 +    * If you want to do it from the command line apparently:
 +      - ''git branch -d master'' to delete the old local branch
 +      - ''git push origin --delete master'' to delete the old remote branch
 +  - Finally, we need to reset the HEAD: ''git remote set-head origin --auto''. You can also do this in your ''.git'' directory, iirc.
  
 ===== .gitignore ===== ===== .gitignore =====
Line 30: Line 48:
 === Specific useful things to ignore === === Specific useful things to ignore ===
  
-So for Unity game you probably want to ignore those .pdb files.+So for [[gmt>Unity]] game you probably want to ignore those .pdb files.
  
   * https://gist.github.com/octocat/9257657   * https://gist.github.com/octocat/9257657
Line 55: Line 73:
 </file> </file>
  
-{{tag>guide software}}+{{tag>cli guide software}}
git.1604097306.txt.gz · Last modified: 2020/10/31 09:35 by rjt