Git push vs. git push heroku master

I just moved from a pc laptop to a Mac, and I’ve noticed a curious difference in how my git commands respond.

Before, I would do the following:

  • intellij idea: how to disable pre-commit code analysis for Git-backed projects
  • git - How to checkout all changed files between two commits
  • How can one change the timestamp of an old commit in Git?
  • How to commit a Git file locally?
  • Git is failing to Stage, or commit with SourceTree in a Windows network environment
  • In Git: Why is it good to commit often?
  • git add .
    git commit -m "These are my new changes"
    git push # This would update my repo on github
    {enter password}
    git push heroku master # This would push to my app on heroku
    {enter password}
    

    Now, when I do git push, the app just deploys on Heroku without pushing to my Github repo.

    How can I ensure I’m updating both places?

    Edit

    Thanks for your two answers! I appreciate the clarification of the difference between git push and git push heroku master, in that git push is pushing towards origin, which in my case, it seems, is Heroku.

    How can I change the settings so that they work as before? i.e. I want git push to now push to my repo on Github, and I want git push heroku master to push to Heroku. The former currently pushes straight to Heroku, bypassing Github completely.

  • In git, can you view the older commits applied to a file after it has been moved?
  • How do I publish a Git Repository from within Visual Studio 2013?
  • How to get rid of Git submodules untracked status?
  • How do I make Git ignore file mode (chmod) changes?
  • Is there a way to make git pull automatically update submodules?
  • Why git is called a distributed source control system?
  • 3 Solutions collect form web for “Git push vs. git push heroku master”

    To get the behavior you want, you’ll need to remove the existing remotes and re-add them:

    git remote show origin # copy down the heroku URL
    git remote rm origin
    git remote add origin [github URL]
    git remote add heroku [heroku URL]
    

    The git push command by default pushes to a remote called origin. This usually points to the place where you cloned your repository from, but you can change it later.

    The git remote show command will show a list of all remotes. Then, git remote show origin and git remote show heroku will detail how each is configured.

    You can manage and change the URL for each remote using the git remote command.

    Just using the command git push–that is, omitting the arguments–means that git is going to have to use the defaults, which would be your first remote repository (commonly named ‘origin’) as the destination, and your local master branch as the source. In your case, I’m guessing that you cloned the project from GitHub in the first place, which makes your default remote be GitHub.

    When you specify the arguments git push heroku master, you are explicitly saying to push your local master branch to the remote named heroku — thus, GitHub is not updated with this command.

    (Perhaps heroku was your first/default remote on the PC, and when you moved to the Mac the origin remote was the clone from GitHub?)

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