在所有git分支中移动文件夹 [英] Move folder in all git branches

查看:404
本文介绍了在所有git分支中移动文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个拥有20个分行的中央仓库,他们都使用如下布局:

  /。gitignore 
/ file1.txt
/file2.txt

现在应该更改为

  /。gitignore 
/ProjectFolder/file1.txt
/ProjectFolder/file2.txt



<所有分支中的。你如何在git中实现这个目标?在所有分支中进行更改?将所有内容合并为主并仅重命名?是否有一些不可思议的命令可以在所有分支中批量重命名? 使用系统提供的脚本并将命令应用到所有分支在 for 循环中。



类似于 bash

 
git结账$ i
....
git commit -m移动文件
完成


We have a central repo with 20 branches, they all use layout like:

/.gitignore
/file1.txt
/file2.txt

Now this should be changed to

/.gitignore
/ProjectFolder/file1.txt
/ProjectFolder/file2.txt

in all branches. How would you approach that in git? Do the change in all branches? Merge everything to master and rename only there? Is there some magical command to batch rename in all branches?

解决方案

Use scripting provided by your system and apply the commands to all branches in a for cycle.

Something like this in bash:

for i in $branches; do
   git checkout $i
   ....
   git commit -m "moved files"
done

这篇关于在所有git分支中移动文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆