How can I checkout a branch in a new gitg? - gitg

In the older GNOME2 gitg interface it was easily possible to checkout a branch by clicking on it with a right mouse button. How can I checkout a branch in the new GNOME3 interface? Right-click now only allows to Rename, Remove, Copy Name, and set a Mainline.

To the best of my knowledge, you can't.
Gitg is a git repository viewer which also lets you merge and commit. But fetch, branch are apparently not implemented.

Related

Source tree not able to push

So I make my file changes, but when I try to push them source tree complains that some one else pushed before me.The files are different,yet I am forced to merge the changes. Some times I have to backup and reset my workspace before it can allow me to push again
Is there no way to force the push?
Open SourceTree Preferences
Tab: Advanced
Third checkbox: Allow force push
Enable the checkbox and close Preferences.
Next time you push, there will be an extra checkbox: Force push.
Checking it will also display an additional Confirm Force Push dialog box before the force push is actually performed.
Even though the files are different, you have to perform a merge or a rebase before you can push. The commits from your current working branch have to be merged into the current branch that exists on the server before you can update it. You're merging the branches, not the files.
Using the "force push" command does not force your commits to be applied in addition to what is on the remote branch - it forces your commits to replace the commits on the remote branch. Using this option would throw away all of the commits that had been made by the other user.
Because this is a destructive operation, SourceTree does not include GUI access to the "force push" command. Here's what Steve Streeting from Atlassian says about it:
SourceTree doesn't expose force push because it's almost always not what you want to do.
It means that someone else has pushed before you. What you should be doing is pulling their changes, merging them (or rebasing your changes on top of them), and then pushing.

Git branching remotely from Eclipse

I have been doing all my work on the master branch. Since I created my project and pushed it into my Github repository, I have been the only one working on it so I have had no need to fetch.
I want to work on an experimental feature, so I want to create a new branch. When I go to "Team -> Switch To -> New Branch" I see this:
It mentions creating a branch based on a local branch. I have read EGit Local vs. Remote repositories but to be honest I am quite confused by it. I'm not sure if I should be fetching or cloning because both are mentioned there, and even then I'm not sure how I would do it (like I said, as I am the only contributor to this project all I've had to do so far is commit and push).
And even then, I'm not sure if Rebase, Merge, None should be my pull strategy as shown in the screenshot?
I was hoping I could just create a new branch, commit and push like I normally do and then switch back to my master branch when I didn't want to work on my experimental feature. It seems like it's much more complicated than that.
I'd like to be able to do this through Eclipse so I learn how for the future, but will it be easier if I just do this on the Git command line? Thanks in advance.
It sounds like what you want is to create your (local) branch based the remote/origin master (use the drop-down list at the top) and then select Merge as your pull strategy. That way when you are working on the branch and pull, it will pull from master and merge any changes directly into the branch. It also allows you to push the branch to remote, which give you another level of safety in case your local repo gets lost or messes up somehow.
Another piece of advice I've learned the hard way: whenever I'm about to do something with git that I'm not totally confident about, I make a quick ZIP or copy of my local repo. That way it's easy to throw away whatever I did and go back to a good state. Sad that git drives us to such measures, isn't it?

MercurialEclipse branches

How to pull changes from one branch to other in MercurialEclipse plugin?
I can't find any info. Also I saw few options: rebase and merge, but I'm afraid to use them, because I work on commercial project.
This is not really a MercurialEclipse question - an answer for plain mercurial would be valid too. The short answer is to use merge. Merge will apply all changes that were made on the other branch to the current branch since the last merge (or since the branch point if there had never been a merge before).
Rebase removes the source changesets so usually isn't appropriate for applying changes from one named branch to another.
A 3rd option is to use transplant. This lets you chose specific changesets to apply onto the current branch.

Using Subclipse - merge

I created a project, I added it to the repository to the trunk. I made a few changes. I'm looking for the correct way to add a new branch now. He wanted me to work a bit over the appearance of the application. Then, if everything comes out, I wanted to combine the projects into a single new version.
How to do it, ask for directions, links.
Thank you and best regards.
PS: Exactly, I mean that if you do everything as I think it is ok it shows me no call from 5 to 6 on the diagram:
image
On Subclipse subpage for graphs (http://subclipse.tigris.org/graph.html) it states:
When the cache is built, it does not gather any merge information, and when you bring up a graph you will not see any merge information. However, for any given revision in the graph, you can select it and take the "Refresh revision" option. That will go out and get the merge information for that revision, store it in the cache, and re-draw the graph. Using the toolbar, you can refresh all of the revisions on the graph at once, although performance for that option is not always great either.
So you should manually refresh revision graph in order to see 'red merge arrows'. Click on "Reload arrows" and choose "Graph revisions".
Instructions on merging and branching in Subclipse.
First, you would do an svn cp of revision one on the trunk to the branch directory. Then, svn switch to the branch and work on the changes. Once they are approved, you would commit everything to the branch, svn switch back to the trunk, and then perform an svn merge of the branch back onto the trunk. Once SVN has completed the merge, you would test the codebase on the trunk to insure it is functioning correctly and all the capability has been properly merged and do an svn commit to complete the merging of the branch to the trunk.

How can I do the equivalent of git rebase -i HEAD~2 in 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?
EGit has rebase, but it does not yet have the interactive rebase you ask for.
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
It is currently available in Eclipse Oxygen, it has it's own wizard for it.
Get the branch you want in the History view
Right-click the commit before the one you want to change
Find Rebase interactive and click it
The Rebase wizard will show up with the commits available to work upon
It works just like the console version, but on a GUI. Even if conflicts arise, it will help you through.
From the history view select the commit you want to rebase to, and create a branch called rebase-point or whatever. Voila, you can now rebase to that branch, and delete it later if you want. I generally prefer using a named branch for things like this anyway, because it minimizes the chance for mistakes on my part. Alternately, consider that origin/master is often the right rebase point if you're squashing commits for a push.
You can also rebase from the Eclipse History view.
Select the repository from the Git Repositories view
Right-click and select Show In History
Select the commit you want to rebase the currently checked out branch on top of
Right-click and select the Rebase on Top of item
Note: You may need to select Show All Branches and Tags first from the History view toolbar to display the commit you are looking for in the table.