Git checkout to specific directory

So, currently I am working on merging two branches, A and B.

I’m merging into branch B, but I had restructured the project into different directories and would like to do a git checkout A --path/fileToGet of sorts (to overwrite is the intention) but into a different directory in my branch. To keep revision history for the file, what would be the best thing, do I just checkout the file like normal, rm my current file and then git mv (or maybe just a regular mv and maybe git will follow` it? Or is there a better method to follow?

  • Why there is no remotes/origin/HEAD --> origin/master for a new branch which I pushed to repo
  • Developing an iphone app using git. Files that must not be shared?
  • How to delete all Git commits except the last five
  • Visual Studio Code Git shows all changes on drive?
  • Can I make git-svn more like git?
  • Git chooses wrong ancestor commit
  • I had found in some comments here at SO that when using git diff A:path/file B:anotherPath/file I am able to compare the two files, so I’m thinking there might be another way, using the : to specify from where, to where.

  • Revert to local commit?
  • Can I have one sub repository inside another, and update the sub repo globally?
  • Git Branch Workflow Dilemma
  • Customs for submitting changes to an open source project?
  • What are possible issues with Git / Mercurial in small developer team?
  • Merging multiple git branches into master?
  • One Solution collect form web for “Git checkout to specific directory”

    rm the current directory and then used git checkout A --path/to/old/location to check the old file location out.

    Git Baby is a git and github fan, let's start git clone.