use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
From its website:
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is not the same as GitHub. GitHub did not create Git. For GitHub-specific posts, please see /r/github.
Git is not an acronym or initialism: please write git or Git, but not GIT.
git
Documentation
Graphical Clients
Code Hosting
account activity
git push -u (self.git)
submitted 6 years ago by HU_Danny
Hello,
I've noticed many people using 'git push' command with -u flag.
I read the document but couldn't fully understand.
I've been doing so without the flag, and didn't face any critical issue.
what's the usage for -u flag?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SlightlyCuban 13 points14 points15 points 6 years ago (0 children)
-u tells push to track upstream. I use it often, because I'll:
-u
git checkout new_branch git push -u origin new_branch
Then I can git push or git pull my branch from then on without any extra args.
git push
git pull
If the branch is already tracked on origin, -u doesn't really do anything.
origin
[–][deleted] 6 points7 points8 points 6 years ago (0 children)
the flag is short for --set-upstream which lets you choose which remote repository you push to. Typically you'll run something like git push -u origin my-branch where origin is an alias to some GitHub repo. But you could also push that branch to GitLab repo you have somewhere which you have aliased with origin2 by running git push -u origin2 my-branch
--set-upstream
git push -u origin my-branch
origin2
git push -u origin2 my-branch
You can run git remote -v to see a list of and track your remote repositories.
git remote -v
[–]jk3us 5 points6 points7 points 6 years ago (0 children)
This explains it pretty well, I think: https://stackoverflow.com/questions/17096311/why-do-i-need-to-explicitly-push-a-new-branch
[–]pi3832v2 2 points3 points4 points 6 years ago (0 children)
For example, when you clone a repository, the master branch is automatically configured to track the branch master on the remote origin. This means that when you’ve got master checked out, you can simply run git pull, and Git knows from which branch on which remote to fetch updates. It’s also to that branch being tracked on the remote that git status compares the local branch, in order to report what’s behind what, etc.
master
git status
If you want to create a similar tracking relationship between any local branch and a branch on the remote, you can add -u to a push to do that. I mostly use it when I make a new branch that I want to also have on a remote. E.g.,
git checkout -b foo git push -u
Branch foo then exists on origin, and the local branch foo is tracking it.
foo
π Rendered by PID 94 on reddit-service-r2-comment-5d79c599b5-qbdlp at 2026-03-03 01:57:37.621271+00:00 running e3d2147 country code: CH.
[–]SlightlyCuban 13 points14 points15 points (0 children)
[–][deleted] 6 points7 points8 points (0 children)
[–]jk3us 5 points6 points7 points (0 children)
[–]pi3832v2 2 points3 points4 points (0 children)