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.

Không có nhận xét nào:

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...