work flow for using git 2.5 for multiple work directories using 'git worktree'

假装没事ソ 提交于 2019-12-05 22:17:01

Creating the two work trees

  1. git clone https://github.com/someone/someproject.git

    (this will give you directory someproject on the master branch)

  2. cd someproject; git worktree add ../someproject-devel devel

    (this will give you directory someproject-devel on the devel branch, assuming such a branch exists)

Switching between these trees

Just use the cd command.

Keeping both trees up-to-date with the upstream master

Just cd in the appropriate directory and run git pull. Doing this in the main working tree first may be best, but is not required (the man page does not address this specifically, and I haven't looked into the worktree implementation in detail. If an issue existed it would only be one of optimal use of space, not functionality).

any other cautions/ special considerations for working this way.

From the man page:

   Multiple checkout in general is still experimental, and the support for
   submodules is incomplete. It is NOT recommended to make multiple
   checkouts of a superproject.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!