简体   繁体   中英

Merging changes head branch to master branch in git

我目前正在eclipse中做一个项目。我在head分支master分支中进行了更改。我想将这些更改合并并将其推送到远程存储库 。请告诉我正确的步骤,以便我合并两个分支并推送更改远程存储库而不会收到非快速预警

I am currently making a project in eclipse.I made changes in head branch and as well as in master branch.

Normally when people refer to "head" they are talking about HEAD , which is not actually a branch but a reference to the "tip" of the currently checked out branch. So if you

git clone foo
cd foo
git checkout bar

assuming bar is a branch, then HEAD would refer to the "tip" or last commit of the bar branch.

If you are getting a non fast forward warning on a push, changes have been made to the remote repository. You to bring those changes into your local branch before you can push.

This is because git requires merge conflicts be resolved in the local repository, not the (usually shared) remote repository. To bring those changes to your local repository you will need to execute a pair of commands; git fetch ... and git merge ... results in a merge commit, which some prefer -- while git fetch ... and git rebase ... if merging the changes without a merge commit is preferred. Note that git pull ... is the same as git fetch ... and git merge ... and git pull --rebase ... is the same as git fetch ... and git rebase ... .

Which ever way your prefer, once you get the changes to your local repository (and resolve any conflicts there may be) you will be ready to push.

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