Reputation: 101
I have done checkout from branch 2.0 .
Now I made changes to one of the file.
I want to commit it to branch i.e 2.0 branch,
So I right click on file , select team->commit option
I ask me to select branch .
So I selected 2.0 and repository url.
When I click , commit & push
, on next box ,it is giving me confirmation box with expected push result as 2.0 [rejected-non-fast-forward].
Is it because of I am in develop group not in master ?
Also I able to changes on my local commit, but it is not reflected in master copy so is their any way to commit it to master copy.
Attached screenshot of confirm box.
Upvotes: 4
Views: 8445
Reputation: 1
This error is shown because you have a gap between your working version in your local system and the committed version on GIT. So for this issue, you have to update your local version to the current version of GIT. After that, you can commit and push your code.
NOTE: PLEASE backup your changes in another location to paste them again in your local project.
Few steps you have to follow.
1) Roll back using soft reset - Go to history(where its showing all previous committed and push version)
Now your system is in the previous state ( before you committed the changes)
2) Rebase - Now you are rebase your local system to the current version committed on GIT using the rebase option. (in the rebase option it's already showing the latest committed changes of GIT)
3)Push & commit - Paste your changes backup in your local project. Then Your project (right click) > Team > commit. Finally, select the commit and push option and your changes go on GIT.
:)
Upvotes: 0
Reputation: 3347
For me .. Rebase was worked. After that I was able to push my changes to the reposiroty.
Upvotes: 0
Reputation: 670
Upvotes: 7
Reputation: 141946
Yep.
You try to push code from branch different to master and you cant.
# commit all your changes to the desired branch (develop is i understand you correctly)
# checkout the master branch
git checkout master
# merge the changes from develop into master
git merge develop
# now push the changes
git push origin master.
The git merge created a new merge commit and now you can push it back to master.
Upvotes: 2