Is it possible to merge a branch without a commit like it would be possible with C git git merge myBranch --no-ff --no-commit?
Repository settings like merge.ff = no or merge.commit = no are ignored.
I'm using EGit 3.0 which comes with the new Kepler release of Eclipse.
The merge options are available in the merge dialog which can be invoked like this:
Select a project
Open its context menu, select Team > Merge...
Chose the branch to merge and the desired options below
Note that currently only squashing and fast-forward options are supported.
It's now available in EGit 3.1 and later.
Indeed it is! You have to use git rebase. This blog post explains how to do it: http://www.kerrybuckley.org/2008/06/18/avoiding-merge-commits-in-git/
Related
I have a typical use case working with feature branches and Git, as follows:
I want to rebase my feature branch onto master, without applying the commits from the branch "1.24", I have managed to do this from the command line specifying all the parameters, but I still cant find a graphical way to do this from eclipse.
What do you do on these cases? It is happening the same to me with merging, I believe this is a very common scenario on GitFlow workflow.
While your feature branch is checked out. Select "Rebase on" in context menu of master branch. That will rebase target branch with all commits that are not on master. That would be a typical use of rebase, not exactly what --onto does, however.
Update:
To select just a partial branch you can use interactive rebase (select "Interactive rebase" in context menu of target branch). It is very quick to use, so you can use it instead of --onto, which I think is not implemented in EGit in any form.
Our version control manager recommends us to use git pull --rebase to pull new changes from upstream branch. I want to use EGit (Eclipse plugin for git) to execute that. How can I do this?
You can also change the rebase configuration of a branch from within Eclipse:
Open the Git Repositories view and navigate to the local branch
Open the context menu and select Configure Branch...
In the resulting dialog, select the Rebase checkbox
EGit also honors the "branch.autosetuprebase" configuration when a new branch is created.
Use
git config branch.*branch-name*.rebase true
And pull will automatically rebase.
You can set it up to configure new branches automatically.
git config branch.autosetuprebase always
New update in Eclipse Mars shows the 'Pull...' option to rebase:
I kind of feel I am missing something here, but here is the question.
I have a branch A. Work is in progress in this branch. A tag T is created which marks a production release version. Now, a fix has to be done on top of the code in this tag. So I created a branch B out of the tag. The branch would contain stable production code.
My eclipse points to checked-out code in branch A.
Now, I want to make changes to code in branch B. How can I make my eclipse realize that there are 2 different branches and the code is different?
Do I have to clone the branch B and point a new eclipse workspace to it?
Cant I use the same workspace and have 2 different versions of the same file - one from branch A and another from Branch B?
Just checkout branch B in your workspace, make your changes, commit, and then you can checkout again branch A and continue to work on branch A. Eclipse will automatically recognize the content of the other branch
However, you should be aware, that you shouldn't have uncommitted changes in your workspace, when you checkout another branch. Either commit your changes or stash, before checkout.
assuming you have eclipse integrated with your git system, you can use select the project you are working on, and then in the context menu, use "Team->Switch To->New Branch...", and choose branch B.
if you don't have it integrated, you can do so with the following 2 steps.
using the git perspective, in the Git Repositories view, find the icon with the + to perform Add an existing local Git Repository to this view .
in the subsequent dialog, choose the location of your repository.
once it's added, go back to your java perspective, and from there, select the project in git (which you currently have in branch A), and from the context menu, select Team->Share Project
I'm just starting working with Mercurial and Tortoise HG. I've created two uncoupled changes, one is a bug fix and one is a new experimental feature.
What is the best way to set this up (using bookmarks, tags or branches or something else) so that I can commit both but push only one of the groups of changesets to the remote repository.
And can this be done easily in Tortoise HG or is command line knowledge of mercurial required?
You can do this from both the CLI and from TortoiseHg. Note that using bookmarks, tag, etc.. has no influence on what you can push.
Using TortoiseHg v1.X.X
Identify the outgoing changesets and then right-click on the head of the branch you'd like to push and select push this branch.
Using TortoiseHg v2.X.X
You must first configure the tool to allow pushing new named branches by clicking Options and selecting the following:
Using the Target option in the Synchronize view, select the branch you want to share and perform the push. This will only share the selected branch. Unchecking Target will cause every new changeset to be pushed.
I'm using git via the Eclipse egit plugin. I am new at using git as my VCS and was wondering if there was a way to create a patch that captures the changes across multiple commits from within Eclipse. For example:
Work on a new feature
Commit work
Fix a bug
Commit work
Create patch of code added since #1
Can this be done from within eclipse using egit? If not, what is the command line for doing this?
The git command you're looking for is:
git diff HEAD~2 HEAD
HEAD means your current commit, and ~2 means "two commits before".
I'm not sure if egit can do this, but I'd look for some sort of arbitrary diff functionality: "diff against... [commit]".