0

I have BranchA which was cut off from master 6 months ago. On specific file: BranchA -> dir1/dir2/abc.txt was done like 300 commits. Meantime on master was done like 3000 commits, but none of them touched master -> dir1/dir2/abc.txt. A few days ago was created a new branch from master -> BranchB. I try to move a file from BranchA -> dir1/dir2/abc.txt to BranchB -> dir1/dir2/abc.txt and have all its history of commits that were done on BranchA -> dir1/dir2/abc.txt.

Sometimes commit on the file BranchA -> dir1/dir2/abc.txt was done with few other files but I am not interested in it.

How I can move the file from BranchA to BranchB with preserving history?

Jaryn
  • 446
  • 4
  • 16
  • Please consider changing how you think about git history. In git, commits _are the history_. A branch is a label for a specific commit, which can be moved. A commit is a snapshot _of the entire repo_. --- All that being said https://stackoverflow.com/questions/2314652/is-it-possible-to-move-rename-files-in-git-and-maintain-their-history – evolutionxbox Sep 13 '22 at 13:33
  • Sorry. My syntax could be confusing. I changed it. Right now name in italic style means name of branch. – Jaryn Sep 13 '22 at 13:41
  • *Git* does not have pull requests. GitHub (the hosting site) provide Pull Requests; Bitbucket (a different hosting site) provide something very similar but not identical but also called Pull Requests. Approval policies for pull requests are host-specific, and the way you get approvals depends on whose project it is. You should figure out who owns this project and ask them how to get approval - don't just ask random strangers on StackOverflow! – torek Sep 14 '22 at 05:20
  • I edited the question to make it more clear. I mentioned PR to give a brief context why we don't merge stuff properly from BranchA to master and later from master to BranchB. As I can see it was bewildering. – Jaryn Sep 14 '22 at 06:33

0 Answers0