How do I use git-new-workdir on windows?

依然范特西╮ 提交于 2019-12-04 23:41:39

问题


I have a repo that has two branches, which i would like to work on simultaneously. After some reading I found git has a script git-new-workdir.


Im trying run use the script from the git for windows bash but get the following error.

$ git-new-workdir
sh: git-new-workdir: command not found

How do I use this script on windows?


回答1:


Due to some of the commands in the git-new-workdir functions not existing on windows, the script won't work.


I have found this windows port of the script. Works great for me.

https://github.com/joero74/git-new-workdir




回答2:


Git 2.5 (Q2 2015) will replace contrib/workdir/git-new-workdir with an official native Git command which works on any OS (including Windows).

The release notes mentions:

does not rely on symbolic links and make sharing of objects and refs safer by making the borrowee and borrowers aware of each other.

That is because the multiple working trees are "linked", or actually recorded in the main repo new $GIT_DIR/worktrees folder.

See "Multiple working directories with Git?" for more.




回答3:


On my installation, the script file is located in /usr/share/git/contrib/workdir/git-new-workdir.

Perhaps if it's not installed in that version of git, you can just download its raw form and run it with bash /path/to/git-new-workdir. At your preference you can also install it in /usr/local/bin changing permissions when necessary.



来源:https://stackoverflow.com/questions/24016143/how-do-i-use-git-new-workdir-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!