How to back up private branches in git

2019-01-29 20:24发布

I have a local branch for day-to-day dev work in git. My workflow is:

  1. Do stuff on local_branch, commit
  2. Fetch origin/master
  3. Rebase local_branch to catch up with new stuff from origin/master

It all works fine, however most of the recommendations I encountered say that one should not "push" private branches, on which rebase is regularly performed.

The problem here is that in this case local branch is not backed up to a server and the only way to save the work is to merge it back to "pushable" branch (i.e. origin/master)

What would be your recommendations on the workflow in this case?

Thanks!

UPDATE: I realised that one of the original requirements I had (avoiding usage of external utilities) is unnecessary limiting.

My current solution is to store all my repositories in a cloud-synchronised folder - this way I get backup for free.

7条回答
smile是对你的礼貌
2楼-- · 2019-01-29 20:51

Can you set up another remote repository that you do push all of your branches to? The other thing to consider is just backing up everything (important) on your local machine, including the git repo.

查看更多
登录 后发表回答