How to merge files and commit them using egit and Eclipse?

What are the recommended steps for committing changes to the main branch with Eclipse + egit?

I have been using Eclipse and svn for a long time and everything works beautifully there. Whenever I am about to commit a change, my flow is the following:

  • git: Why am I ahead of origin/master with X commits after I do 'git push'?
  • Undoing a single-file Git Checkout
  • What should I do when git revert aborts with an error message?
  • Git branch. How to assign a commit to a branch?
  • How to know if latest commit to master has been pushed to the remote?
  • Find commit where file was added
    • synchronize with workspace
    • look for conflicts
    • when conflicts are found, merge manually and then mark file as merged
    • update
    • commit

    In the rare cases where I attempt to commit a group of files without a commit, I am warned about it and can correct the changes nicely.

    Even if I update files that are conflicting, it isn’t bad to recover from that though I find that synchronizing with workspace first to identify and merge files with conflicts is a much better flow than attempting to merge after an update that failed because of conflicts.

    With egit, no flow that I tried worked properly. First, if I mistakenly do a pull from the server and that there are conflicts, I am told there was a conflict but then am very confused about it: I have a hard time retrieving the latest from server and find it impossible to commit my files no matter how much synchronization I do. Even replacing my file with the latest from head and doing another pull and then commit doesn’t seem to work anymore.

    Even if I follow the same approach I used with svn (synchronize first and merge manually files with conflicts) and follow second with a pull, I still get the same failures I mentioned above, as if my marking a file as merged wasn’t accounted for.

    So… blank sheet of paper, what are the recommended instructions when I made some changes, want to merge them with the latest code on server (which may include file changes conflicting with my set of changes), and, optionally, want to commit my changes? Pointer to a good egit tutorial is fine if there is one discussing this kind of issues.

  • git gc / git gui: Unlink of file <internal pack file name> failed
  • bitbucket git push not permitted
  • Checking out a maven project from a git repository
  • How do I build a C++ project using Eclipse CDT?
  • Git push rejected after cloning
  • Commit message prefix in git
  • One Solution collect form web for “How to merge files and commit them using egit and Eclipse?”

    I’m not sure if I understood your question correctly. But I’m now trying to give you some hints. We recently converted the repository of our company from CVS to git which was quite challenging as we had a lot of questions focussing on the same problem you are targeting.

    First of all I have to say that coming from SVN or CVS you won’t be able to do your workflow as you did maybe for years.

    Especially working on a small set of files and updating only those via synchronize won’t work with git. Here are the steps I take when synchronizing (in terms of getting the latest from the server) with our git.

    1. I commit. Early commit is what saves you a lot of pain! Don’t have pending changes when synchronizing with a remote repo, as with egit this could result in quite a bunch of pain.
    2. I fetch. With egit you can put the action into the toolbar or even create a shortcut for it, which makes the fetch quite comfortable.
    3. The result of the fetch will be presented in a dialog. I study the changes, cause this is the best point to do this with egit, as I think. You can read all commit messages and even double click them for opening a commit in the background and study the diff. Yes, this dialog is not modal.. so you can move it on the second monitor.
    4. I do a rebase. Which is similar to a merge but doesn’t leave the information from which point you started your temporary development. This is kind of a design decision my company made – to prefer rebase over merge.
    5. If you have conflicts you can use the merge tool to solve them. This is quite similar to the synchronizing you did with CVS. Remember to do a Add to index as it’s the new mark as merged. Afterwards you should do Rebase > Continue if you did a rebase.
    6. I do a push. And if nobody pushed in the meantime that’s it.

    That’s my workflow. If that’s the right direction I can add more details why I do several steps as I do and how I think the best way is doing them with egit.

    Git Baby is a git and github fan, let's start git clone.