Reputation: 16058
What is the best way to backup a complete branch from a local git repository on one PC with the purpose of adding it to a local git repository on another PC.
In the case where the remote git repository server is offline due to failures on their end.
Upvotes: 10
Views: 34813
Reputation: 5440
as oneliner for per minute backup ... ( this will bloat your git branch -a )
git branch $(git rev-parse --abbrev-ref HEAD)--$(date "+%Y%m%d_%H%M") && git branch -a | grep -i $(git rev-parse --abbrev-ref HEAD)
which is actually a 2 liner:
git branch $(git rev-parse --abbrev-ref HEAD)--$(date "+%Y%m%d_%H%M");
git branch -a | grep -i $(git rev-parse --abbrev-ref HEAD)
Upvotes: 3
Reputation: 1327034
First, you can make a local clone of your current repo, including only your branch:
git clone -b mybranch --single-branch /path/to/your/local/repo.git
Then you can make a bundle of that repo, in order to easily save it (a bundle is a Git repo, compressed into one file).
If you have the possibility to make a bare empty repo somewhere accessible (even through a simple shared folder), you could simply push your branch to it.
Upvotes: 9