todo-git
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
todo-git [2017/03/10 23:31] – [Renaming branches] dblume | todo-git [2021/11/14 00:23] – [Updating a local repo after remote's already renamed its branch] dblume | ||
---|---|---|---|
Line 100: | Line 100: | ||
====== Renaming branches ====== | ====== Renaming branches ====== | ||
+ | |||
+ | ===== Updating both local and remote repos ===== | ||
To rename a remote branch: | To rename a remote branch: | ||
Line 116: | Line 118: | ||
- | ==== Changing | + | ==== Creating |
- | < | + | |
- | $ git checkout -b branch_name | + | Switched to a new branch 'new_branch' |
- | Switched to a new branch 'branch_name' | + | |
- | </ | + | |
- | That was the same as "git branch | + | That was the same as "'' |
+ | |||
+ | And now if you want to create that branch name at the remote branch, then: | ||
+ | |||
+ | $ git push --set-upstream origin new_branch | ||
==== Changing a local branch to a new remote branch ==== | ==== Changing a local branch to a new remote branch ==== | ||
Line 139: | Line 143: | ||
</ | </ | ||
+ | ===== Updating a local repo after remote' | ||
+ | <code bash> | ||
+ | git branch -m master main | ||
+ | git fetch --all --prune | ||
+ | git branch -u origin/main main | ||
+ | git remote set-head origin -a | ||
+ | </ | ||
====== git at dlma.com ====== | ====== git at dlma.com ====== |