Notice that I’ve made a distinction between bc3 and bc33. You now can issue the same commands as outlines above but with ' git bc3' or 'git bc3dir' rather than 'git difftool' and 'git diffdir' Beyond compare integration is there out of the box but I would create some alias entries so you don’t have to type in the full command as that would be painful. So what does all this mean to me? Do I actually need to edit my. So, that means that if you have the option ‘Handling -> follow symbolic links’ in the ‘session settings – folder compare’ dialogue of beyond compare (I recommend that you save this as a session default) then any editing of files that you do WILL be in the working folder of your git repo. Well if one of the sides contains the modified (current working directory) files then the copy is not a hard file copy it’s a simlink to the file in the working directory. I’ve also found that you can actually edit and save files whilst using the diffdir commaand, here’s how/why:Īs I said before when using the -dir-diff command git makes copies of the files into a temp location. Use 'git difftool -tool bc3' to open your diffs in beyond compare.Use 'git difftool -tool-help' to show all the options you have, do you see bc3 in the list? if so you are set to go.Out of the box you can use beyond compare as your difftool.Which I've only tested on linux centos 7.0 with git 1.8.3.1: Since writing this post I’ve done more playing with git, difftool and beyond compare and have made the following revelations. Just replace the difftool and mergetool commands from the above code snippets with the following:Ĭmd = "'c:\\Program Files\\Beyond Compare 4\\BCompare.exe' $LOCAL $REMOTE"Ĭmd = "'c:\\Program Files\\Beyond Compare 4\\BCompare.exe' $LOCAL $REMOTE $BASE $MERGED" The users gitconfig is located at c:\users\UserName\.gitconfig So if you do want to modify the files as you do a comparison you must use the more interactive difftool command. This is because behind the scenes when you use the -dir-diff flag, git copies the modified files to a temporary location and then performs a directory diff on them. You might notice that when you use the diffdir command that the files are not editable, where as if you use the more interactive difftool command that the local files are available for changing and saving in beyond compare. #As soon as you close beyond compare the next change will pop open (due to the -no-prompt flag) #View all changes both staged and modified one by one. #View the diff of one un-staged file, note the use of -no-prompt to stop the prompt on the terminal #View all differences between two change sets (SHA-1 ) in beyond compares directory view #View all differences between master branch and bugfix branch in beyond compares directory view #View all committed differences between the current HEAD and the penultimate commit one by one #View all un-staged differences one by one Usage - launching beyond compare from the git command line: In fact you can see how I install beyond compare in my vagrant bash scripts here: The above assumes that you have installed beyond compare and it is now accessible from the terminal as bcompare. (In fact the little tweak is shown in the appendix at the bottom).Įdit your ~/.gitconfig (c:/users/UserName on windows) by adding the following:Ĭmd = bcompare \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"ĭiffdir = difftool -dir-diff -tool=bcompare -no-prompt The following code snippets are taken from a centos linux build, but there is no reason that with a little tweak this wont work on a windows machine. Using git diff is ok when you are looking at a small set of changes but if there are many changes across many files I much prefer to use beyond compare to visualise the change set. It's brilliant for all the tasks related to file and folder diffs, either on the file system or in source control when viewing changes between revisions or branches. I'm a massive fan of Beyond compare, I use it a lot. EDIT - See footer for more info and an alternative to the main body of this post.
0 Comments
Leave a Reply. |