How long does 'Git push -u' remember the parameters for?

I just got started with a tutorial on Git.

There, they mentioned a command

  • Git remote has master but no HEAD
  • How do you remove git version 1.9.4msysgit.2 from windows 7?
  • Error on first git aws.push to elastic beanstalk
  • How to I “move” my commits from “no branch” to an actual branch?
  • Egit in eclipse missing tree
  • git-svn display svn repository url
  • git push -u origin master

    where the changes made on local branch master are pushed to origin repository(on Github).
    And the -u tells git to remember the parameters so that next time we can just write git push

    Can someone tell me whether git remembers the parameters only for the very next time we use git push, or every time henceforth till a command to tell git to forget the parameters is written? Also, is any there such command?

    Thanks in advance!

  • Git - how to track untracked content?
  • Git single or seperate for different project?
  • Git pull needs to discard local files
  • Get latest tag of repo
  • Git in android studio commit error
  • What are the file limits in Git (number and size)?
  • 2 Solutions collect form web for “How long does 'Git push -u' remember the parameters for?”

    In the command

    git push -u origin master
    

    The -u flag means that your local branch will become a tracking branch. That is, a branch that tracks a remote branch, so that future git pull will know which branch to merge from and git push will be directed to the correct remote branch.

    Technically, the tracking adds the following information about the master branch to your .git/config file:

    [branch "master"]
        remote = origin
        merge = refs/heads/master
    

    and it creates a file here .git/refs/remotes/origin/master, representing the remote branch.

    These settings are local to the current repository, so they will not apply to other repositories.

    The changes in .git/config are permanent (until you explicitly change them), so the effects of git push -u are permanent.

    git push -u tells git to track the remote branch locally (an ‘upstream tracking reference’), so git push whilst on the local branch will then always push to the remote branch specified in the initial git push -u. This will persist on the branch (or master in your case) until the next push -u you do (which will cause it to track another remote branch).

    It’s also used so that other git commands know where to retrieve data from e.g. git pull uses it to pull changes made to the remote being tracked to the local repo.

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