Recently I faced a unique issue wherein I have to include only the newest commits in a branch discarding all the old ones.
e.g. consider I have such a commit structure:
[main branch]
af474e3 (HEAD -> main) Updated modal UI
c0f9599 Added modal UI <-- This commit onwards is what our requirement is
e50c805 Updated button UI
de2ab3c Added button UI
9b1822f Initial commit
(I know this sounds silly but,) I want to get all the (latest) commits from that point onwards with all the commit information associated with it i.e. commit date, commit author etc.
The created branch must look like:
[new branch]
af474e3 (HEAD -> new, master) Updated modal UI
c0f9599 Added modal UI
I tried removing/squashing commits with interactive rebasing
, it didn't work.
Cherry-picking
didn't work either.
Can this be achieved? Is there any easy way to achieve this?