How to resolve merge conflicts in multiple commits in EGit? - eclipse

I have multiple commits (30+) on the same branch that are in conflict with another branch. The conflicts are reported during rebase.
I can resolve those conflicts once (in one commit), but repeating it 30 times does not make sense to me.
Any recommendations on how to do this in Eclipse (EGit)? For example, would you recommend using "Skip commit" button?

Try using merge instead of rebase.
If you have to use rebase, try using git rerere command.
Details:
Git rebase conflicts after successful merge?

Related

Git merge conflict issue, gir merge conflict while pulling

My coworker and I are working in the same branch which was cut from develop. There are many files to be taken care of by both of us.
The scenario I’m facing is that
I did some changes and pushed my code to the remote repo. My coworker also did some changes in his local and and now he is not able to take a pull. It shows merge conflict while pulling.
Can someone let me know how can we resolve this?
Based on my understanding, I think we made some changes in the same files and now to merge them, git is causing that conflict.
First, make sure to use:
git config --global pull.rebase true
git config --global rebase.autoStash true
That way, a simple git pull will:
stash your work in progress
rebase your local commits (not yet pushed) on top of the updated remote upstream branch (instead of merging). That keep the history linear.
You can also activate rerere in order to not resolve the same conflict over and over again.
Finally, in case of merge/rebase conflict, you will need to chose between "our" and "their" version in each file with conflict markers. As shown here, an IDE can help facilitate the visualization and resolution of such conflicts.
I used tortoise git
git tortoise > git diff
Then I manually resolved the git merge conflict by removing or modifying the code I didn’t want.
Then I committed the code and the issues were gone.

resolve merge conflict github - use specific branch

I have two branches, develop and master. I push all my new work into develop and when done I need to merge it into master. I ran git merge --no-ff develop when in the master branch, but now I have a lot of merge conflicts. Is there a quick way to resolve these so I always use the develop version, instead of having to open each file and resolving them that way? Thanks
If you're in a merge you don't want to go forward with right now, the first thing to do would be to abort that merge with git merge --abort
Then if you want to merge your 'develop' branch into checked out branch 'master' while always taking changes from 'develop' where conflicts arise, the way to do that is with git merge -X theirs develop where master is checked out already.
See:
Is there a "theirs" version of "git merge -s ours"?
and: I ran into a merge conflict. How can I abort the merge?
for reference.

How should I structure my git-svn workflow to avoid "revision1 is merged into revision2, but does not have git-svn metadata"

I am using git-svn in my workplace since our current version control server is subversion and switching completely to git does not seem to be on the horizon for now (*cry*)
My workflow is as follows
I have the following branches
master tracks remotes/trunk
local/0.4 tracks remotes/0.4
work is my development branch for the master branch
work-0.4 is my development branch for the local/0.4 branch
I work in my work branches, then I merge to master and local/0.4 using
git merge --no-ff <branchname>
After that I check in to svn via
git svn dcommit
and I use
svn.pushmergeinfo=true
to update the svn:mergeinfo properties so my colleagues won't get angry with me messing up that metadata for them :)
However, I just had the following problem which stumps me.
I had done two commits on the work-0.4 branch, then I merged these to my local/0.4 branch with git merge --no-ff work-0.4. After this, I did git svn dcommit and recieved the following message
Committing to https://svn-server ...
e138050f6ebd2f2ca99cbefc5e48acae412e1f86 is merged into revision f5f2345e8e5fc64
20423bdc00397b5853b3759c4, but does not have git-svn metadata. Either dcommit the
branch or use a local cherry-pick, FF merge, or rebase instead of
an explicit merge commit.
After some rebasing and reset'ing of branches I managed to push everything to svn, but my solution entailed doing a rebase of my local/0.4 branch to the work-0.4 branch which in turn meant that I did not get to squash my two git-commits into one svn-commit :/
I feel that I'm probably doing something wrong with my workflow here, and it might be related to svn.pushmergeinfo. The docs for svn.pushmergeinfo says
config key: svn.pushmergeinfo
+
This option will cause git-svn to attempt to automatically populate the
svn:mergeinfo property in the SVN repository when possible. Currently, this can
only be done when dcommitting non-fast-forward merges where all parents but the
first have already been pushed into SVN.
and to be honest, I'm not quite sure that I understand that correctly? Am I doing something weird here that makes svn.pushmergeinfo not work correctly? How should I structure my workflow to optimally work with git-svn correctly (setting proper mergeinfos etc)?

how to resolve conflict with git after autoformat in Eclipse?

We have two users working on the same class files in two separate git branches.
User A does nothing else but an "autoformat" Ctrl-Sift-F in Eclipse
User B just adds a space in a comment
Now we get a "conflicting change" and can't merge anymore.
Basically we are stuck just because of the autoformat.
How to resolve this situation in Eclipse git or on command line git bash?
You can use git merge -s ours or git merge -s their to decide which version of the file you wanna keep after the merge.
Resolve the conflict as you would with any merge conflict. It sounds like a pretty simple conflict to resolve. Or since the changes were trivial, the person doing the merge (i.e. the person who hasn't pushed their commit) can just reset back to a common commit, allowing them to pull the other person's changes.
git reset --hard THECOMMITID^
Where THECOMMITID is the unwanted formatting change. If it's just the most recent commit then you can use HEAD^.

How do I remove a completely failed commit?

I was having issues with my faulty git commands, so I have multiple git commits but not the branches or repository.
git rebase -i HEAD~# doesn't have any of the faulty commit ids on the branches including master.
Is it still possible to delete them?
It's a little unclear what your situation is, but it sounds like you want to delete some commits, even though they aren't showing up on your branches?
If that's true, that the commits lie outside your branches, they may be on a merge branch which git creates temporarily. This is a branch just like yours, but is not as obvious to find.
Maybe try pasting some of your git status and git branch outputs with a little more info on your situation?