Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8829437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:50:02+00:00 2026-06-14T07:50:02+00:00

My git-svn work flow is as follows: Production code goes in master, off which

  • 0

My git-svn work flow is as follows:

Production code goes in master, off which I do my git svn dcommits/rebase. I work on feature/topic branches, and continue to rebase -i to master and merge until I’m ready to bring those into master and subsequently push to svn trunk using dcommit.

I can usually do git checkout - to checkout the previous branch I was on.

For some reason though, when I do git svn rebase, and then try to git checkout to my previous branch, it does not work (it just stays in master). That is, lets say I do:

(master)$ git checkout -b my-feature-branch

I do some work on that branch, then commit

(my-feature-branch)$ git commit -am "Some work"

I then want to bring in the latest changes, and the quickly change back to my branch:

(my-feature-branch)$ git checkout master
(master)$ git svn rebase

This brings in the latest svn trunk changes into master. Now I just want to quickly change back to my topic branch.

(master)$ git checkout -

At this point, the branch checkout stays as master. I’m guessing some sort of operation is popping off the last branch I worked on, but I don’t know about the internals to know this for sure.

So my question is, does anyone know why this is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:50:03+00:00Added an answer on June 14, 2026 at 7:50 am

    When you run git checkout -, git consults the file .git/logs/HEAD to find the last branch that you checked out.

    When you run git svn rebase, this triggers the cmd_rebase function in the git-svn command, which in turns calls:

    command_noisy(rebase_cmd(), $gs->refname);
    

    This calls rebase_cmd, which looks like this:

    sub rebase_cmd {
            my @cmd = qw/rebase/;
            push @cmd, '-v' if $_verbose;
            push @cmd, qw/--merge/ if $_merge;
            push @cmd, "--strategy=$_strategy" if $_strategy;
            push @cmd, "--preserve-merges" if $_preserve_merges;
            @cmd;
    }
    

    So the git command line built by this chain looks something like:

    git rebase $gs->refname
    

    (where $gs->refname would be substitute with a branch name.) And from the git-rebase man page:

    If <branch> is specified, git rebase will perform an automatic git checkout
    before doing anything else. Otherwise it remains on the current branch.

    Since the rebase command specifies a branch name, rebase performs a checkout, which appends an entry to .git/logs/HEAD even if you are already on that branch. This is why the target of git checkout - is not what you expect after running git svn rebase.

    UPDATE I may be wrong about why rebase is performing the checkout, but if you examine .git/logs/HEAD you can see clearly that rebase is performing (multiple) checkouts. For example, if I have a branch master and a branch b1 (descended from master), and then do:

    git checkout master
    git rebase b1
    

    I end up with the following in the the log:

    6240c11... c4bfd14... Lars Kellogg-Stedman <lars@example.com> 
      1352952244 -0500  checkout: moving from b1 to master
    c4bfd14... 6240c11... Lars Kellogg-Stedman <lars@example.com> 
      1352952260 -0500  checkout: moving from master to 6240c1154706c675d19d771ad36aebc2658a5df8^0
    6240c11... 6240c11... Lars Kellogg-Stedman <lars@example.com> 
      1352952260 -0500  rebase finished: returning to refs/heads/master
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using git-svn to work with an svn repository. I have my git master
I've been using git-svn for the past three weeks. Currently my work flow is
I have a workflow(on svn) which I am trying to replicate with git, but
I'm using git-svn to work against svn repository. The layout is standard, and I
I have been using git-svn to work remotely on a spike for a new
My normal git-svn workflow is to do my work on a local branch, then
I'm using Git-Svn to interact with a Svn repository at work and I can't
I am using git-svn with the following workflow now git clone <SVN TRUNK URL>
I am using git-svn (from cygwin) and I've done several git commits on my
I use git svn to track a SVN repo. When I try to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.