tags:

views:

31

answers:

2

My workplace uses Subversion for source control so I have been playing around with git-svn for the advantages of my own branches, commit as often as I want without touching the main repo, etc.

Since my git svn checkout is local, I have cloned it to a network share as well to act as a backup. My thinking is that if my desktop takes a dump I will at least have the repo on the network share to get changes that I have not had a chance to dcommit yet.

My workflow is to work from the desktop, make changes, commit, etc. At the end of the day I want to update the repo on the network share with all of my current changes. I had setup the repo on the network share using git clone repo_on_my_desktop and then updating the repo on the network share with git pull origin master. The problem that I am running into is when I used do a git rebase to squish multiple commits prior to dcommitting to the main svn repository. When I do this, I get merge conflicts on the repo on the network share when I try to backup at night.

Is there a way to simply sync entirely with the repository on my desktop without doing a new git clone each night?

A: 

You shouldn't be doing a rebase if you intend to pull from another repo.

If you don't mind overriding changes in your network share, you can do this:

git fetch origin master
git reset --hard origin/master

This will reset the local master to the origin master.

Warning: this is a hard reset, it will lose all your changes (committed* or not).

But I'm assuming you don't really have any changes there, and it's mostly just a backup.

* Note: technically speaking, committed changes are not lost until they expire from the reflog, but for all intents and purposes, they're effectively lost.

hasen j
+2  A: 

Two comments:

1/ I would recommend having either bare repo or a bundle (one file, easier to move around) for your network share

2/ I would rather add network_repo as a remote to your desktop repo and push from there (git push --force network_repo master): you stay in your working repo.

VonC