1

I've been using Tortoise Git and today took to learning GITbash commands to help perform a task of comparing changed files that are not part of the master branch.

Using

$cp -pv -parents $(git diff MyBranch..Master --name-only) C:/Temp

This saves the file locally to my machine, these are files that have changed and is the file from master (same results if i reverse the branches), not sure how i get the files from the commited local branch.

I want to then save down the file locally from Mybranch with the purpose of having both sets of files so I can use windows software to compare file differences.

I can show a single file via

$git show master:MFile > C:/Temp

If i pass in the diff command it can only view one file which i assume is a limit of the show command.

Using Git commands can i get the files that have changed in the local branch and have been commited and the same files from master, i.e. have 2 copies of each file, the master copy and the file from local branch that's been commited but not merged to master, thanks.

Rob Tyketto
  • 33
  • 1
  • 5
  • Are you looking for [`git difftool`](https://git-scm.com/docs/git-difftool) ? Try `git difftool -d master myBranch` – LeGEC Sep 20 '21 at 18:42
  • I'm trying to get a list of the files from master and from the local branch so I can use another tool, as using the GIT url to see difference or the difftool used by tortoise Git are not as good as beyond compare. if 6 files have been changed from master, I would like to saved down the naster and changed commited files to use a tool like beyond compare which is really great for seeing the differences more clearly. – Rob Tyketto Sep 20 '21 at 19:13
  • What I meant is : `git difftool` is made for this specific purpose : open a diff in an external diff viewer. See for example [this other question](https://stackoverflow.com/questions/22654763/use-beyondcompare-to-see-difference-between-files-in-git) or [this page on scootersoftware.com](https://www.scootersoftware.com/support.php?zz=kb_vcs#gitwindows) for setup instructions, then try to run `git difftool -d master myBranch`. – LeGEC Sep 20 '21 at 20:37

1 Answers1

0

Another approach, beside difftool, is git worktree (that I present here)

You can restore two copies of the same cloned repository, in two different folders, for two different branches.

That allows you to use any diff tool you want (from Git or not), and compare any file, each one from their respective branch.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250