I was working locally on master branch. (by mistake) but it's ok with me this time as I control my code.
I took the following steps:
Egit->commit and push (to master)
Egit -> pull (to get other developers changes)
I got a message that there is a conflict with one file and I merged it.
Now I see: [My Product | Merged Master (up arrow)2 (down arrow)1]
I see in the symbols next to the files that the other developers created - black sign as if there are uncommitted.
A. What does the 2 up arrow and 1 down arrow mean?
B. Why do I see uncommitted changes? they are not mine
C. How can I work out on master after my merge?
D. I looked in bitbucket and didn't see that my changes were committed to the remote branch. What is wrong?
I know that I am supposed to work on branches - but for now - how do I fix the situation?
A. Two arrows up means you have two commits in your local branch that aren't in the remove branch. The one arrow down means there is one commit in the remote branch that you don't have locally. The solution is to do a git pull followed by a git push
B. Uncommitted changes are probably from your conflict. After a conflict, you have to resolve the conflict, add it to index and then commit that change. This is known as a merge commit. My guess is you have not done this.
C. Work out on master? You mean you want to work directly on top of master? After you resolve your conflict, you should be all set to do that. Branching is better though. To create your own branch just do git checkout -b my_featue_branch
Related
I have two different branches release/ver1 and release/ver2 and code base are completely different.
My requirement is to merge to the following:
1) Merge release/ver1 branch to the master and do the build.
2) Followed by the same day, Merge release/ver2 branch to the master and do the build.
Note: I can merge only to the master ( web hooks PR notifications are configured like this and I cannot create new release branches and merge to it)
Whenever I merge, I am getting merge conflict and every time, I need to manually resolve the conflict and as the code base are totally different, it takes lot of time to resolve manually the merge conflict error.
What would be the best resolution for the above situation?
Try at least to activate first git rerere
cd /path/to/repo
git config rerere.enabled true
If the same conflicts are involved in your different merges, git rerere would have recorded their resolution and can apply them automatically.
See "Git Tools - Rerere".
I'm an admin on this repo. In this PR I have removed multiple files and merged these changes from local to origin/develop. When merging origin/develop to origin/master I'm getting this conflict for one of the four files I've removed. Our flow is always local to origin/develop to origin/master. I had no conflicts when mergin local to origin/develop.
Github won't let me resolve the conflict.
Questions:
Why is the 'Resolve Conflicts' button disabled? I've never seen this before.
Why would this one file have a merge conflict? It's one of 3 config files that I removed completely in this PR.
Why am I getting this conflict on origin/develop to origin/master when I had no conflicts on local to origin/develop?
If the Resolve conflicts button is deactivated, your pull request's merge conflict is too complex to resolve on GitHub Enterprise or the site administrator has disabled the conflict editor for pull requests between repositories. You must resolve the merge conflict using another Git client like Atom's Git integration or the command line.
I know this is little old post. But putting my answer as I also faced the same issue and I could solve it using following.
As shown in screenshot attached, you can solve this on your local using command line.
Fetch the branch which has conflicts. (say master branch)
Checkout to that branch.
Pull the code from another branch you want to merge it into. (Take a pull from develop into master )
OR Rebase the branch as: checkout to develop branch, then take pull into it git pull origin develop. Then checkout to master branch and do git rebase develop.
Now resolve the conflicts, add the changed files, commit it, push onto the branch you want to merge it into (in this case master ). It might happen that you don't have permission to do it. In that case you can push this branch on your fork, and then raise PR to main repo)
There is one more method.
Using GitHub Desktop. Just that, it is not available for linux from official site.
For this you can check this link.
Read the instructions in the README doc and install it accordingly.
And you can find the method to solve the conflicts using GitHub Desktop here.
This is maybe a dumb question, but I could not find a way to solve my problem. I am working with Eclipse and Git.
When switching and pulling branches to work on different features, the local commits of the previous branch are added to the commit history of the new branch.
Let say I am working on a branch A, commit twice, then I create from master a branch B, switch to this branch B, pull, and perform one commit. Now my branch B contains the changes made on branch A + the commit made on branch B, making it difficult to create a pull request to merge the change of the only commit B to master.
I would like my local commits/changes to be erased when switching to another branch. How can I do that with Eclipse Git?
After playing around with eclipse, I noticed there was two possible pull actions:
The default one does Fetch + merge, resulting in the mess described in the question
The other option allow you to select Fetch + rebase, to rebase your working directory to the state of the remote branch.
Based on this answer https://stackoverflow.com/a/17324792/10631518 you can even make rebase the default behaviour by running
git config branch.autosetuprebase always
I am quite new with Gitlab and I'm having an issue for merging in Eclipse.
We're working as a team, and we all have development branches that we are trying to merge into a single one. Unfortunately, when I did my merge, I have done a stupid mistake. Instead of merging my development branch to the main one, I have merged the main one into my development branch.
I have reversed the commit/merge on gitlab, but now as I try to merge back my development branch into the main one on Eclipse, it seems like I am 9 commits ahead of this branch (described as the arrows on Eclipse here: ), so the potential merge would basically replace everything by my code, when I should actually have merge conflicts to solve.
I am not quite sure how to merge properly so that I get back these merge conflicts.
Here is a screenshot of my network:
The ['1'] commit in the network on the left branch (my branch) corresponds to the merge from Week6AllIssues to my dev branch (the wrong merge). The last commit on this left branch is me reversing the commit.
Thanks a lot for your help !
If you're not using the remote branch with anyone else, the following series of steps might help.
First, remove the superfluous commits from the local branch. It can be achieved with git reset --hard <the commit before you merged master into your branch> command (see this link on how to do this with Eclipse).
Now make the remote branch match your local branch. You can do this with git push --force command. In Eclipse, this command corresponds to configure push - enable "force update" option.
Now the superfluous commits are gone.
I have 2 branches - master and develop
I have been doing some pull requests in my develop branch where it contains 5 items, in which it is the same as the number of items in master.
However, someone did some commits and pushed in a few more items into the master branch, and hence now it has 8 items.
As my pull request in the develop is still not yet approved/merged, whenever I tried to update my pull request, I am getting the message stating that This pull request can't be merged. You will need to resolve conflicts to be able to merge and asked me to do the following:
git fetch origin master
git checkout develop
git merge FETCH_HEAD
git commit
git push origin HEAD
And this happens after I have 'pushed' out my commits, making me confused at times. Then I realized that it is asking me to re-add and re-commit in the additional 3 new items. So does this means I must ensure that the items and contents between these 2 branches of mine should be the same as always? I have always used git pull/fetch but will there be a better way for me to make sure?
What this means is that GitHub would like to merge your PR branch into master, but it can't, because there are conflicts. As you've discussed in the question comments, the best way to deal with this (usually) is to merge your master branch into develop on the command line. That will show you the conflicts and ask you to resolve them. Once you've completed and pushed that merge, the PR will be mergeable back into master using the green button on GitHub.
You could simply merge your deploy branch into master (which I realize sounds a bit more sensible). In that case, you'd be bypassing the PR entirely. You'd have to close the PR "unmerged", and separately you'd manually push the merge commit to master.
By doing it the first way,
you make a better audit trail by merging to master on GitHub, using the PR;
you give your team a chance to review your code after the merge, before it lands on master; and
if you have automatic tests (such as Travis CI or CircleCI) which check PRs, you give them a chance to run your merged code as well.