git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git rebase: yet another newbie quest.

From
Theodore Ts'o <tytso@mit.edu>
Date
Sep 8, 2014, 14:07 UTC
Message-ID
<20140908140758.GI1066@thunk.org>
In-Reply-To
<87sik28bir.fsf@osv.gnss.ru>
On Mon, Sep 08, 2014 at 05:52:44PM +0400, Sergey Organov wrote:
Show 8 quoted lines
> 
> I didn't intend to make topic branch from the very beginning, and
> already made a commit or two on the remote tracking branch bofore I
> realized I'd better use topic branch. It'd create no problem as far as I
> can see, provided vanilla "git rebase" has "sane" defaults. That said,
> I've already been once pointed to by Junio that my definition of "sane"
> doesn't take into account workflows of others, so now I try to be
> carefull calling vanilla "git rebase" names.
Right, so what I typically in that situation is the following:

<on the master branch> <hack hack hack> git commit <hack hack hack> git commit <oops, I should have created a topic branch> git checkout -b topic-branch git branch -f master origin/msater

This resets the master branch to only have what is in the upstream commit.

> Please also notice that I didn't pull immediately after I've re-arranged
> my branches, and this fact only made it more difficult to find and
> isolate the problem.

It's also the case that I rarely will do a "git rebase" without taking a look at the branches to make sure it will do what I expect. I'll do that using either "gitk" or "git lgt", where git lgt is defined in my .gitconfig as:

[alias]
	lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
And typically what I will do is something like this:
gitk -20 master origin/master topic
-or-
git lgt -20 master origin/master topic

The "git lgt" command is very handy when I want to see how the branches are arranged, and I'm logged remotely over ssh/tmux or some such, so gitk isn't really available to me.

Cheers,
						- Ted
Previous: Sergey OrganovNext: Sergey Organov
Message 4 of 9 in “git rebase: yet another newbie quest.”
  1. Sergey OrganovSep 5, 2014
  2. Theodore Ts'oSep 5, 2014
  3. Sergey OrganovSep 8, 2014
  4. Theodore Ts'oSep 8, 2014
  5. Sergey OrganovSep 8, 2014
  6. Theodore Ts'oSep 8, 2014
  7. Sergey OrganovSep 8, 2014
  8. John KeepingSep 5, 2014
  9. Sergey OrganovSep 8, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.