Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7936671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:17:09+00:00 2026-06-03T22:17:09+00:00

Tried to use what’s here , but that doesn’t solve things for me. I’ve

  • 0

Tried to use what’s here, but that doesn’t solve things for me.

I’ve got a local repo in git, cloned from a remote repo, development. I branch locally to play around with a new feature in a branch called newBranchName and call git push origin newBranchName to set up the new branch on the remote repo.

Now when I try to push, git seems to be pushing my newBranchName local branch into everything the old branch tracked as well. I want that to stop.

Here’s an extended sample of what I mean. I’m going to create a local branch, add a file, commit locally, then push to a new branch on the remote server. So far, so good.

Administrator@BOXEN /path/to/working/dir (oldBranch)
$ git branch testingStuff

Administrator@BOXEN /path/to/working/dir (oldBranch)
$ git checkout testingStuff
Switched to branch 'testingStuff'

Administrator@BOXEN /path/to/working/dir (testingStuff)
$ vim test.txt

Administrator@BOXEN /path/to/working/dir (testingStuff)
$ git add test.txt

Administrator@BOXEN /path/to/working/dir (testingStuff)
$ git commit -a
[testingStuff 11468d8] Testing git; can trash this branch.
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 test.txt

Administrator@BOXEN /path/to/working/dir (testingStuff)
$ git push origin testingStuff
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 299 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To http://url/to/remote/repo.git
 * [new branch]      testingStuff -> testingStuff

Now, I’ll edit that test.txt file, commit the change, and push. This is what confuses me.

Administrator@BOXEN /path/to/working/dir (testingStuff)
$ vim test.txt

Administrator@BOXEN /path/to/working/dir (testingStuff)
$ git commit -a
[testingStuff 2be7063] more testing git
 1 files changed, 1 insertions(+), 0 deletions(-)

Administrator@BOXEN /path/to/working/dir (testingStuff)
$ git push
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 276 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To http://url/to/remote/repo.git
   11468d8..2be7063  testingStuff -> testingStuff
 ! [rejected]        oldBranch -> remoteTrackedByOldBranch (non-fast-forward)
error: failed to push some refs to 'http://url/to/remote/repo.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

I want to continue pushing to testingStuff remotely, but want to stop pushing to remoteTrackedByOldBranch when I type git push. I don’t want to delete any branch — seems a number of answers to similar questions suggest deleting rather than untracking. Nor do I want to know how to push to a specific branch only by explicitly naming it in the git push command. Too many muscle-memory mistakes that way. I want git push to push to origin/testingStuff only.

I’ve already unsmartly (a word which proves itself) butchered my .git/config trying to accomplish this, and it’s still pushing to remoteTrackedByOldBranch.

EDIT: Here’s what my .git/config file looks like after doing the above:

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
        hideDotFiles = dotGitOnly
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = http://url/to/remote/repo.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[branch "oldBranch"]
        remote = origin
        merge = refs/heads/oldBranch

Nothing about the testingStuff branch in there.

EDIT: git branch -avv output:

Administrator@BOXEN /path/to/working/dir (testingStuff)
$ git branch -avv
  master                                 721aa61 initial setup
  projectFork1                           e132f5f Fixed Construction grid labels getting sliced.
  projectFork2                           1d20317 initial load
  oldBranch                              1d20317 initial load
* testingStuff                           192f622 Still testing
  remotes/origin/HEAD                    -> origin/master
  remotes/origin/empty                   ec1c694 initial setup
  remotes/origin/joeUserFork1            771f43e Initial Load
  remotes/origin/master                  721aa61 initial setup
  remotes/origin/projectFork1            e132f5f Fixed Construction grid labels getting sliced.
  remotes/origin/oldBranch               1d20317 initial load
  remotes/origin/joeUserFork2            dc605e8 What was sent initially.
  remotes/origin/testingStuff            192f622 Still testing
  remotes/origin/upload_master           0d8c440 Initial Load
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:17:10+00:00Added an answer on June 3, 2026 at 10:17 pm

    Only push the branch you’re on

    By default, git will push all of your tracking branches whenever you issue a git push with no arguments. to make it only push the branch you’re on

    git config push.default upstream # git 1.7.10
    git config push.default tracking # older vesions use "tracking" instead of "upstream"
    

    if you want git to always work like that – you can use the –global switch or simply edit your ~/.gitconfig file to suit.

    Stop tracking a remote branch

    git’s config is just a file. Quite often the easiest way to investigate and or fix your git config – is simply to open your .git/config file and edit it

    e.g. if you have a section like this in your .git/config file:

    [branch "develop"]
        remote = origin
        merge = refs/heads/develop
        rebase = true
    

    and you make it:

    [branch "develop"]
        rebase = true
    

    your branch nolonger tracks anything. You can also just delete the whole section and git will act the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried: use information_schema update referential_constraints set delete_rule='cascade'; but got the following error:
Tried to use the following code, but it doesn't work properly: // download the
I tried to use git cherry-pick for merging some commits from master and then
I tried to use TestNG with Apache Ivy , but was unsuccessful. Here is
I tried to use DriveInfo.IsReady, but it returns false if an unformatted floppy is
I tried to use this on my class library mylib.core.data.dll and got a successful
I tried to use an image file in my HTML template. But when I
I tried to use object expression to extend the IDelegateEvent, but in fsi there
I tried to use $.cssRule() plugin and found that it makes it inconvenient to
I tried use file_put_contents output new page. but I meet some trouble in breaking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.