How to work simultaneously on several different versions of files with git?

前端 未结 2 994
余生分开走
余生分开走 2021-02-04 13:08

I\'m currently working on a my own neuroimaging toolbox that runs under MATLAB / SPM8 and most program files in my repository are MATLAB *.m files. I have different

2条回答
  •  面向向阳花
    2021-02-04 13:49

    As an alternative to cloning the repo as explained by Kevin Reid, you could also just use git-new-workdir to create a second working copy for your repo. That way, both working copies will always automatically see the same branches, because they share one git repo.

    The advantage over cloning the repo is that there's no need for any manual synchronization/merging. The moment you commit in workdir A, the commit will be visible in workdir B (e.g. git log).

    Only caveat: When you change the repository (commiting, rebasing, resetting a branch etc.), you should not have the same branch checked out in the other workdir - otherwise git will get a bit confused (see git-new-workdir: Commit in working tree A causes bogus changes in tree B ).

    See: git working on two branches simultaneously

提交回复
热议问题