kraftydevil
kraftydevil

Reputation: 5246

How to make 'git push' work like 'git push origin branch'?

Here's a git status showing that I have one commit ready to be pushed:

$ git status
# On branch develop
# Your branch is ahead of 'origin/develop' by 1 commit.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean

But then trying git push doesn't work:

$ git push Everything up-to-date

Even when I use git branch develop --set-upstream-to origin/develop, git push still says 'Everything up-to-date'.

How can I force the behavior of git push to match git push origin branch?

New information: I believe this to be unique to this repository as other repositories on my machine have 'git push' working fine.

New information (2): .git/config file of the project in question:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = false
[gitflow "branch"]
        master = master
        develop = develop
[gitflow "prefix"]
        feature = feature/
        release = release/
        hotfix = hotfix/
        support = support/
        versiontag = 
[remote "origin"]
        url = https://obfuscated.unfuddle.com/git/obfuscated_ob/
        fetch = +refs/heads/*:refs/remotes/origin/*
        push = refs/heads/master:refs/heads/master
[branch "develop"]
        remote = origin
        merge = refs/heads/develop
[branch "master"]
        remote = origin
        merge = refs/heads/master

Upvotes: 2

Views: 1381

Answers (1)

redhotvengeance
redhotvengeance

Reputation: 27866

You can control this behavior with the Git push.default config setting.

Sounds like value you want is simple. simple will push the current branch to its remote branch of the same name. You can set it like this:

git config --global push.default simple

To see all of the options for push.default, check out the docs (search for "push.default").

Upvotes: 2

Related Questions