0

I was working on this feature in on of the open source project, however, due to some other work, I stopped for working on for quite long.

Now I want to make some changes to this feature branch and push this. However, the pull request says there are some conflicts and I should resolve it first.

I am new to Git so things look really confusing.

Following are the details.

Remote Branch: https://github.com/robotframework/Selenium2Library/

My forked Branch: https://github.com/Gaurang033/Selenium2Library

Pull Request: https://github.com/robotframework/Selenium2Library/pulls/Gaurang033

this is how my branch look

git branch -vv

*feature-table-functions fecb9a6 [origin/feature-table-functions: ahead 1] incorporated comments

Now how should I update the branch and resolve the conflict and push new changes?

git pull --rebase
Current branch feature-table-functions is up to date. git status
On branch feature-table-functions Your branch is ahead of 'origin/feature-table-functions' by 1 commit. (use "git push" to publish your local commits)

And this is how it looks on my GitHub forked project

Community
  • 1
  • 1
Gaurang
  • 171
  • 1
  • 14
  • Possible duplicate of [How to do a GitHub pull request](https://stackoverflow.com/questions/14680711/how-to-do-a-github-pull-request) – dannemp Jul 24 '17 at 09:53
  • @dannemp it's not, the question there is generic, mine here is very specific, I already have the pull request in the review. – Gaurang Jul 24 '17 at 10:06

1 Answers1

0

If this is really an open source project, then those conflicts are probably due to other people's work which has come in since you last synched.

How you proceed here really depends on the repository and the rules of the open source project. Though generally you would resolve the conflicts in one of two ways:

  • you do a git pull (and merge)
  • you do a git pull --rebase

In either case, you will be bringing in the latest changes to your own local branch, resolving the conflicts, and then issuing another pull request for your work.

In your case, since you are on your own feature branch, you would need to fetch the latest master branch, and then merge or rebase with that:

git fetch origin
git checkout feature-table-functions
git merge origin/master
# or git rebase origin/master

After this you can push your feature-table-functions branch to the remote. Note that if you went with the rebase option, you might have to force push the branch.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
  • two things. 1. on my github page it says my master is 7 months old. 2. I think after `git merge origin/master` it will ask me to resolve the conflict. right? – Gaurang Jul 24 '17 at 10:09
  • Is your branch eventually going to be merged to `master`? You missed an important point in my answer: `git fetch origin`. You don't merge with your 7 month old `master`, you merge with the latest version. – Tim Biegeleisen Jul 24 '17 at 10:12
  • `git fetch origin` is going to get me the data from my forked project to my local machine, right? and my branch is already 34 commits behind and 4 commits ahead. is it ahead of master or forked project or remote? After the merge the changes of the master will be merged to my feature branch, right ? but it's 7 months old. shouldn't I worry about that. – Gaurang Jul 24 '17 at 10:17
  • I have given you enough information to resolve your problem. If you are this unsure about how Git works then you should stop and review a tutorial. This isn't the way to learn Git. – Tim Biegeleisen Jul 24 '17 at 10:20