File content in Sublime does not change on Git branch change

If a file is open in Sublime text 2, and then branch is switched which has changes to the file in the terminal, the file contents are not updated in the Sublime text 2 until the editor is selected by clicking on it.

How to auto-magically change it?

  • How to pull a git repository from remote server?
  • key_load_public: No such file or directory even though file exists
  • Git Rebase after Cherry-Pick
  • How to set timezone in tig?
  • What's the difference between overwriting a file and checking it out?
  • git rebase after a big refactor
  • Xcode push workspace with submodules wrong repository on push
  • push to git repo
  • Vagrant shell and ansible provisioning fail with bitbucket
  • git synchronization of rebased branches
  • git error: unable to index file FacebookSDK.framework/Headers
  • Two different connection strings for web.config in Git
  • 3 Solutions collect form web for “File content in Sublime does not change on Git branch change”

    Sublime Text does not have any built-in way to do this. Though perhaps a Sublime Text plugin could do it by combining the file refresher plugin in the forum thread with a Python equivalent to watchr.

    This Sublime Forum thread asks how to make a file in a different tab update automatically, given that Sublime Text is already frontmost. The asker couldn’t find a way to make Sublime Text do that, but as a workaround, wrote a plugin that lets them hit a hotkey to reload all open tabs.

    You could try to solve this with the same principle, by making a system-wide hotkey to switch to ST2 and back. You could implement the hotkey with AutoHotkey for Windows or Quicksilver or Keyboard Maestro for Mac. It’s not as good as automatic updating, but it’s the next best thing. You could hit the hotkey every time you expect the file to have changed.

    You could even use a tool like watchr to monitor for changes in the files you plan to edit, and automatically triggers an AutoHotkey script or AppleScript that switches to Sublime Text and back when a file is updated. It would be even better to dispense with the GUI scripting and using Sublime Text’s Python interface to reload the view without switching to it, but I don’t know if Sublime Text allows you to run Python in the app from a program outside the app.

    I had the same issue. Go to the git tab above and manually change the branch. that should revert the files back to any branch you want. The git tab above will work without typing anything into the terminal and will update with these git changes from sublime automatically.

    This just works in Sublime Text 2 and 3 on Mac.

    Git Baby is a git and github fan, let's start git clone.