Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I do the equivalent of git rebase -i HEAD~2 in eGit?

Tags:

git

eclipse

egit

I know how to rebase onto a specific branch or tag using eGit in Eclipse, but I haven't found a way to rebase onto a specific sha1 using eGit. I'd like to do this in order to squash commits before pushing to upstream (ie, doing git rebase -i HEAD~n where n is some number of commits ago where I want to rebase). Is this possible with eGit? If not, is there another Eclipse plugin I should be using that would provide this functionality?

like image 491
Zach Avatar asked Aug 25 '11 21:08

Zach


People also ask

How do I clone a Git repository EGit?

Cloning Repositories In order to checkout a remote project, you will have to clone its repository first. Open the Eclipse Import wizard (e.g. File => Import), select Git => Projects from Git and click Next. Select “URI” and click next. Now you will have to enter the repository's location and connection data.

How do I merge EGit branches?

Your task is to merge a different branch into that branch. After doing a "fetch" to ensure that your branch metadata is up to date, right-click on the repository and select "Merge...". Select the branch you want to merge into your current branch. After that completes, inspect the "Git Staging" view.

How do I create a pull request in EGit?

On GitHub, navigate to the fork's page. You should see a message there indicating that a new branch was created and a button to create a pull request. Click this button. On the next page, you can provide more information and finally confirm the creation of the pull request.


2 Answers

EGit has rebase, but it does not yet have the interactive rebase you ask for.

like image 51
robinr Avatar answered Sep 19 '22 01:09

robinr


I've been successful squashing commits using steps from this post (cut and pasted here):

If I want to squash the last m commits on the current branch then I

  • select in history the first commit which I don't want to squash
  • right-click and say "Team->Reset->Soft"
  • right-click and say "Commit". This commit will contain all the changes of the last m commits together
like image 24
Roy Truelove Avatar answered Sep 23 '22 01:09

Roy Truelove