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:

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

 https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...