简体   繁体   中英

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?

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.

rm当前目录,然后使用git checkout A --path/to/old/location签出旧文件位置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM