Skip to main content


Showing posts from January, 2017

Pushing Specific Commit in Eclipse Git

This post describes the real-world scenario, then offers the steps to solve the issue at the bottom. If you are in a hurry, jump to the end of the post to see the steps in Eclipse, without my self-indulgent story-telling!

A few months ago, my team switched from the ancient Visual SourceSafe to Git. While we tried to minimize the process impact, the change-over was such a big shift in thinking that, months later, I still field several questions a week.

Here is a recent trouble-shooting sample: a colleague got caught in mid-task with an urgent fix, and mucked up some commits in her local repository. Her question: how can only the fix-commit be pushed.

Email excerpt:
Hey Steve!
Okay - so I have 2 files that I need to push to repository X for a high priority fix for tomorrow.

I have a 3rd file that I was in the middle of changing when I had to interrupt to get the high priority one fixed and in.  It is currently in a state of flux and full of errors.
But when I went to do a pull so that I cou…

Faster Git History View in Eclipse

Actually, 2 tips about Git History view in Eclipse today:
(1) Faster loading of History view in Eclipse Sometimes in Eclipse, viewing the History of a file, folder, repository or branch can take several seconds to load. Git promises faster access to the History of source changes because they are local, and this is generally true. But when there are thousands of files and many years of history, including occasional refactoring and restructuring, the History view can lose some of that speed.
One simple setting change made our History views in Eclipse faster: In Eclipse, select Window -> Preferences. In the tree-view of categories, navigate to Team -> Git -> History Uncheck the preference for “Follow Renames” Click OK.
This made a big speed improvement in our History view’s load time.  But it comes with a cost:

Abort a Git Merge or Cherry-Pick

Recently a colleague of mine used the Git Cherry-pick feature to bring one of their commits from one branch of our repository to another. They hit a somewhat complex merge conflict and, in trying to resolve all of the conflicts in the file, they got confused about what needed to be done.

They came to see me with the question: can they cancel their cherry-pick and partial merge, and start over?

The answer is Yes: it is possible to abort a merge or a cherry-pick Git operation.

Most of the time it is not needed; with a little work and human intelligence, the merge conflicts can be resolved without too much trouble. But sometimes, in cases like my colleague faced, a more complex merge winds up confusing the developer, and they want to go back and start over.

If you use git from the command-line, it’s as simple as: git cherry-pick --abort or git reset --merge
On my team, about a quarter of us use Git from the command line, but most - like my colleague in this story - prefer to use the Eclipse…