git checkout is obsolete since Git 2.23 (Q3 2019): use git switch for branch operation.They actually need to reset -hard their local master to the remote/master branch they will fetch, and forget about their current master. when master is recreated on remote, a pull will attempt to merge that new master on their local (now old) master: lots of conflicts.if other users try to pull while master is deleted on remote, their pulls will fail (" no such ref on remote").Git push origin master # create master on remote The -force option for git push allows you to override this rule: the commit history on the remote will be forcefully overwritten with your own local history. Git checkout -b master seotweaks # create a new local master on top of seotweaks Some common examples of when you may need to force push in Git include: After you Git rebase a branch locally After squashing commits that have been pushed to. The git push -force -u origin command overrides this restriction in Git, meaning it allows you to forcefully overwrite the commit history of your local branch to the remote repository branch. Git push origin master-old # create master-old on remote Git push origin :master # delete master on remote (Regarding GitHub, house9 comments: "I had to do one additional step, click the ' Admin' button on GitHub and set the ' Default Branch' to something other than ' master', then put it back afterwards") git branch -m master master-old # rename master on local (If you are working with branches, use the branch name instead of master branch). (Make a git remote show to check how your remote is declared within your local repo. Conflict resolution using git force pull. That might not be the case here since everyone seems to be working on branch ' seotweaks'. You can rename/remove master on remote, but this will be an issue if lots of people have based their work on the remote master branch and have pulled that branch in their local repo.
0 Comments
Leave a Reply. |