我只需将master
分支中的所有文件复制到production
分支,然后在那里生成缩小代码等,并在production
中进行检查。
我不想合并但只复制文件。
我试图在谷歌搜索,但我很困惑。
我遵循这种粗俗的方法:
#currently I'm in master branch in current directory
rm -rf /tmp/production
cp -r . /tmp/production
rm -rf /tmp/production/.git
git checkout production
cp -r /tmp/production/* .
是否有任何单行命令?
答案 0 :(得分:0)
git checkout master
cp -r . /tmp/production
rm -rf /tmp/production/.git
git checkout production
cp -r /tmp/production/* ./copy_of_production
我想是的。
答案 1 :(得分:0)
您可以重复使用" How can I overwrite, not merge, one remote branch into another branch?"
中的方法git checkout production # First, merge master into production so we have
git merge -s theirs master # a merge commit to work with.
git checkout master # Then, flip back to master's version of the files
git reset --soft production # Then we go back to the merge commit SHA, but keep
# the actual files and index as they were in master
git commit --amend # Finally, update the merge commit to match the
# files and index as they were in master.
这不是一行,但确实记录了master
覆盖production
内容的事实。
答案 2 :(得分:-1)
你可以做的很简单的事情就是当你创建分支生产时,你将定位为掌握然后你可以推动原产地。
示例:
git checkout -b production //to create branch production
git checkout master // to be positioned on the master
git push origin production