SETUP DIFFTOOL TO VS CODE
git config --global diff.tool --default-difftool
git config --global -e
will open up vs code (or default editor)
put these lines
[diff]
tool = default-difftool
[difftool "default-difftool"]
cmd = code --wait --diff $LOCAL $REMOTE
save and close the editor
to test :
to show difference between 2 commits
- git difftool HEAD HEAD~1 or git difftool commit1 commit2
to show difference between current local state and a commit
- git difftool HEAD or git difftool commit_id
should show the difference of the 2 states side by side, per file.
TURN OFF THE PROMPT
if you don't want it asking if you want to open the editor when command git difftool is used, then:
git config --global difftool.prompt false
SETUP MERGE TOOL TO VS CODE
- git config --global -e
- add the following lines, save and close.
[merge]
tool = code
[mergetool "code"]
cmd = "code --wait $MERGED"
[mergetool]
prompt = false
keepbackup = false
No comments:
Post a Comment