Error pushing changes using git package on Atom — “The tip of your current branch is behind its remote counterpart. Try pulling before pushing.” (already tried pulling)

Hey @CarlyRaeJepsenStan, this is a factor of git’s design along with the way Glitch uses your project’s git repo. By default (unless you set the config value mentioned in the error message) you can’t push to a working repo (as opposed to a bare repo - this piece of git docs glancingly discusses the difference) on the checked-out branch. This is because when you do so you also have to go to the remote and checkout the new changes, or you won’t see them in the working code.

You have a couple of options here.

  1. you can set the receive.denyCurrentBranch flag in your git config. If you do that, when you push you need to go to your project and run git checkout master && refresh in your console. That will check out the changes you just pushed and refresh the editor to sync them.
  2. you can put your changes on another branch (say, glitch) using git checkout -b glitch locally, push that branch to your project, then go to your project’s console and use git merge glitch && refresh.

This is basically a side-effect of the fact that your project’s git repo is a working repo, whereas a typical git remote is a bare repo (it doesn’t have the actual files in it, just the list of changes to files). We plan to do some work to make these workflows easier in the future, but I don’t have a specific timeline on when we might get to that.