atlassian sourcetree - How can you get one file out of a another branch of a Git repository/ -


i'm using git. have code in 1 branch want get. there easy way version of 1 file different branch or easy way make other branch appear in directory of file system?

just clear, want have other version examine, don't want replace version have it.

i'm using sourcetree, i'd happy accept command line based answers well?

i think (from last entry in documentation git checkout), you're after (not sure sourcetree though, sorry):

git checkout mybranch -- mypath/myfile 

source: https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html

git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>… 

when <paths> or --patch given, git checkout not switch branches. updates named paths in working tree index file or named <tree-ish> (most commit). in case, -b , --track options meaningless , giving either of them results in error. <tree-ish> argument can used specify specific tree-ish (i.e. commit, tag or tree) update index given paths before updating working tree.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -