简体   繁体   中英

Merging between forks in git repository

I have forked a repository 'B' from main repository 'A'. Now there are some changes done to A and also B now. Now I am going to push the local changes of B into B repository. But before pushing to B, I want to pull the changes done to repo A into my local. Merge it and then push the net changes to my B repo. Later I have to raise a pull request to my A repo so that my approver can approve the code.

Currently, when I try to pull the changes done to A, I get the below error.

On branch development Your branch is ahead of 'origin/development' by 2 commits. (use "git push" to publish your local commits)

That's not an error but rather a point of information. It's telling you that your local tracking branch of the origin/development branch (likely called development , but technically it can have any name), has commits that aren't present in the origin repository's development branch.

Given that you just issued git pull , you most likely had a commit locally you hadn't yet pushed, and the second commit is a merge commit conducted by the git pull operation.

You can tell which commits you have that origin doesn't with

git log origin/development..<branch>`

where <branch> is whatever your local tracking branch is called. Technically, there's no reason you can't execute the rest of your plan. Just make sure you know what you're pushing, first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM