Git: Copy source code to new branch without history

Viewed 13837

I have 2 branches in git repository: common and myown.

I want to copy the source from one branch to another branch but I want to see in history of common branch only commits related to feature migration (from myown to common).

Is it possible to copy the source without the history or is a new repository required?

In addition it can be necessary to merge from common to myown and after some changes copy source back as new commit (and only as that commit - without history of all other commits as I said previously).

3 Answers

Clean the folder but keep hidden files/folders:

mkdir ../delete
mv * ../delete
rm -rf ../delete

Copy source code from branch:

git checkout <branch> .
Related