On Sep 15, 4:23 pm, Marcello Henrique <fara...@gmail.com> wrote:
> Is possible copy files between local branches, for example:
> marce...@itacellus:/var/www/moodle-git$ git branch -a
>   UFG_18
> * UFG_19
>   remotes/origin/HEAD -> origin/UFG_18
>   remotes/origin/UFG_18
>   remotes/origin/UFG_19
> I want copy in file system from branch UFG_18 to UFG_19, because we 18
> and 19 is versions and different codes.
> I try doing clone two times from different directories, and copy from
> them, but I think this is not the right way.

I cannot quite parse what you wrote; I understood this as you want to
copy a file from the tip of another branch to the working directory.

To do this you use `git show TREEISH:path/to/file >path/to/local/file`
where "TREEISH" is anything pointing to a tree: the name (hash) of a
commit, a tag, a branch name etc.
For instance, if you want to replace the file foo.c in the working
directory with the contents of the same file as found at the tip of a
non-current branch UFG_18, you can use `git show UFG_18:foo.c >foo.c`.
If you want the contents of that file as found in some previous commit
made on the branch UFG_18, you first get the name of that commit (by
studying the output of `git log UFG_18` for instance) and then use
that commit name in place of the branch name with `git show`.

Read git-rev-parse manual page for details.
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to