GitHub request branch name

Let me make sure I'm right, I'm new to Git.

  • Suppose I created a project fork on GitHub and made some changes. If I were to commit, click and register a transfer request for these changes, which is considered good practice, to create a new named branch with a name specific to what I did.

  • Because if I just used the master and then clicked on the other (unrelated) changes to master on my fork, they will automatically be added to the pull request. At least I understand the following from using migration requests :

Pull requests can be sent from any branch or commit, but it is recommended that you use the topic branch so that subsequent commits can update the retrieval request if necessary.

Suppose the retrieval request is accepted by the maintainer.

  • If my theme thread is merged, all I need to do to get back in sync is fetch from the support repository.

  • But if the topic branch was recreated, the story was overwritten, and fetch from the guardian repeater would provide me with a "duplicate" of my topic branch (at least, this is how it works in mercury).

  • Regardless, if my branch is merged or recreated, the branch (or rather the name) is deleted. Creating a maintenance repository contains one leading branch.

+4
source share
1 answer

If you posted material in your master branch, which is not in upstream/master ( upstream , which is the remote descriptor of the official repo), I recommend pushing back a couple of commits and then merging upstream/master back:

 >> git checkout master # make sure we're on master >> git branch oldmaster # create a new branch, just to be safe >> git reset --hard HEAD~100 # roll back 100 commits >> git fetch upstream # fetch newest changes from upstream >> git merge upstream/master # merge the main master branch into your local one 

In the end, you have to put your messy branch in oldmaster and official in master .

+2
source

Source: https://habr.com/ru/post/1447898/


All Articles