Hiển thị các bài đăng có nhãn copy to new branch. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn copy to new branch. Hiển thị tất cả bài đăng

Git: Copy source code to new branch without history

 Git: Copy source code to new branch without history - Stack Overflow

I found a faster way that can be used:

git checkout <branch> -- .

This will replace the content of the currently checkouted branch by the content of the <branch>.

This doesn't copy <branch> commit history.

If you just want to checkout only some files just replace the . with the file paths from <branch>.

EDIT: I found out that this will only replace current files and it will not delete files that are not on the <branch>.

It is then better to run rm -rf before doing the checkout.

anti-pattern là gì

  Trong công nghệ và lập trình, Anti-pattern (mẫu phản diện) là những giải pháp bề ngoài có vẻ hiệu quả để giải quyết một vấn đề phổ biến, ...