Outdated branch pull request in Git

Asked

Viewed 441 times

2

I created a branch of a repository in the Github. I worked on that branch creating their own commits. The branch is in the remote repository.

However, the master, developing code in master.

In principle the developments of master and of branch are in different files.

I wanted to pull request to merge the branch code into master. Which is the best way to keep all files up to date?

Example of a scheme of commits:

A-B-C-D-E-F-G -> master
   \     /
    A-B-C -> mobile
  • Are you sure it’s not pull request What do you want? I work using gitflow, we’re almost 10 developers tweaking code and code, often fiddling with the same files. Usually in different functions, but the same file anyway. Like each branch has a distinct evolutionary purpose and the ultimate destination is master, develop or the rc being stabilized at the moment, we don’t care much about keeping each of the 20 or 30 branches in sync

  • Pull back from your branch with master, resolve possible conflicts, and then pull back to master. This will update your branch and master to the same code.

2 answers

0

If you have merged the branch in the master you need to revert to the master to follow the next steps..

git reset --hard origin/master

After that you can safely pull back on master to stay up to date with remote origin

git pull origin master

Then update the commit history in the branch mobile

git rebase master mobile

if there is a conflict in any commit you must fix and execute git rebase --continue.
A Tree of mobile will be as follows:

A-B-C-D-E-F-G -> master
             \     
              A-B-C -> mobile HEAD

0

On Github, you can make a Pull Request branch mobile to the branch master.

After this, this merge request will be available for evaluation. If all is right, just enter the pull request and approve (do the merge) of the same in the master.

If there are conflicts, you have two options:

  1. Do the merge branch master to the branch mobile, to resolve conflicts and to push from resolution to branch mobile. Pull Request will automatically detect that the conflict has been resolved and allow merge.
  2. Do the merge manually (without using pull request) branch mobile to the branch master. Conflict resolution will take place in the branch itself master.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.