Reputation: 1040
I am merging one project to another project using merge and while merging some of the files are deleted due to conflict and I am able to checkout the file from branch I temporarily created but I need to maintain the history. Is it possible to checkout a file with history.
Steps followed
git remote add tmpmerge <giturl>
git fetch tmpmerge
git merge tmpmerge/branch --allow-unrelated-histories
While following above steps some files are deleted (10 files & totally 327 files).
I want to checkout the file from temp branch tmpmerge/branch with history and I can able to checkout the file using below command
git checkout tmpmerge/branch -- <filepath>
I need to checkout the file with history . Please let me know is it possible to do it. Thanks in advance
Upvotes: 2
Views: 1136
Reputation: 121
You cannot checkout some file like SVN or CVS, but you can see them with git show [commit]:[file]
Example
git show c50ec5a:./src/main/java/com/demo/myx/DemoServiceApplication.java
to retrieve DemoServiceApplication.java
on commit c50ec5a
.
by this result you can append > file_output
for save result to file_output
like git show c50ec5a:./src/main/java/com/demo/myx/DemoServiceApplication.java > file_output
and you can use gitk --follow [file]
to retrieve file full history.
Example
gitk --follow ./src/main/java/com/demo/myx/DemoServiceApplication.java
.
Upvotes: 1