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 6963787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:50:24+00:00 2026-05-27T15:50:24+00:00

I frequently use git ‘guerrilla-style’ by nesting a git repo inside a Subversion, Perforce

  • 0

I frequently use git ‘guerrilla-style’ by nesting a git repo inside a Subversion, Perforce or CVS sandbox. When I’m working this way, I like to create a ‘remote’ repo on a USB stick so that I have a backup, in case my hard drive dies:

$ git --bare init /f/projects/myproj.git
$ git remote add origin /f/projects/myproj.git
$ git push -u origin master

Then I just need to remember to type git push every now and then to back up my work. If my repo gets hosed, I can get it back with:

$ git clone /f/projects/myproj.git

Lately I’ve been maintaining a stack of patches against an upstream Perforce repo using StGit. My simple backup strategy no longer works in this case. Neither git clone or stg clone seem to work: if I type stg series after cloning, it tells me stg series: master: branch not initialized.

Poking around some, I’ve seen that stgit creates a master.git branch and several other temporary(??) branches to store metadata. It seems like it should be possible to set things up so that all these branches get pushed to the backup repo, but I’m not sure how to go about it.

Update [12/15/2011]: Looking at the stgit-managed repo I want to back up in qgit, I see that it looks like this:

enter image description here

I tried Jefromi’s suggestion of using push --all:

$ git --bare init luasand_stg_bak
Initialized empty Git repository in c:/d/projects/luasand_stg_bak/
$ cd luasand_stg
$ git remote add backup ../luasand_stg_bak
$ git push -u --all backup
Counting objects: 369, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (364/364), done.
Writing objects: 100% (369/369), 467.79 KiB, done.
Total 369 (delta 73), reused 0 (delta 0)
To ../luasand_stg_bak
 * [new branch]      master -> master
 * [new branch]      master.stgit -> master.stgit
Branch master set up to track remote branch master from backup.
Branch master.stgit set up to track remote branch master.stgit from backup.

This pushes the master.stgit branch, but doesn’t push some some other required metadata:

enter image description here

From the above screen shot, you can see there’s a top-level patches folder and a refs/patches folder that are present in the original repo, but not in the backup. This all leads me to believe I’m barking up the wrong tree. Is there no way to back up the StGit metadata using standard git commands? If not, what’s the best way to back up my work-in-progress on a complex patch series in case of a borked rebase or hard drive failure?

  • 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-05-27T15:50:25+00:00Added an answer on May 27, 2026 at 3:50 pm

    It seems that trying to back up an StGit work area by cloning is counterproductive. I’ve settled on a simpler method that relies on stg export and stg import. It works like this:

    $ pwd
    /c/d/projects/luasand_stg
    $ stg push -a
    $ stg series
    + add-copyright-notice
    + add-bn-namespace
    > fix-tabs
    $ stg export --dir=/f/projects/luasand_stg_patches
    Checking for changes in the working directory ... done
    $ cd ..
    # Pretend STG sandbox got borked
    $ rm -rf luasand_stg
    # Re-clone it from the original repo
    $ stg clone luasand luasand_stg
    Cloning into luasand_stg...
    done.
    $ cd luasand_stg
    # No patches?  No problem, just reimport them from the backup
    $ stg series
    $ stg import -s /f/projects/luasand_stg_patches/series
    Checking for changes in the working directory ... done
    Importing patch "add-copyright-notice" ... done
    Importing patch "add-bn-namespace" ... done
    Importing patch "fix-tabs" ... done
    Now at patch "fix-tabs"
    # Everything restored
    $ stg series
    + add-copyright-notice
    + add-bn-namespace
    > fix-tabs
    

    So, rather than attempt to back up the whole repo, I’m just backing up each individual patch to /f/projects/luasand_stg_patches on my USB stick. This means I have to ensure that the source repo, luasand is backed up somewhere, too, so I can recreate the state of my work area by (re-)cloning it with stg clone and re-importing my patches.

    I don’t love this workflow, but at least I can understand it. I’ll wait awhile before accepting this answer to see if anyone can offer a simpler solution…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I frequently use git stash and git stash pop to save and restore changes
Hi I have SVN repo that I frequently use for change management. However after
I'm a working with eclipse in Ubuntu. In eclipse, i frequently use a shortcut
I'm working on a music related website, and frequently use the HTML special characters
In ASP.NET, what functions are allowed inside the <%# %> tags? I frequently use
I frequently use HTML output in applications, up to now I've used some simple
I frequently use the following pattern to set an upper bound to the running
I use Visual C++ 2008 in Visual Studio 2008. I frequently use the following
I am using NetBeans for PHP 6.5. In my code I frequently use the
People use frequently something like: <ListBox ItemsSource={Binding ElementName=thisControl, Path=ListIndexes}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Label Content={Binding

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.