Difference between alias and branch in git

I’m new to version control and git. I’m confused by git push [alias] [branch].

What is the difference between an alias and branch?

  • Git branch behind remote after rebase
  • Git SSH public key denied
  • Eclipse egit : How to synchronize with remote repo?
  • After a cancelled rebase in progress, I cannot update my branch from master branch?
  • Git: how to check out the currently pushed branch in the pre-push hook?
  • Update my Forked version of a project on Github
  • Xcode keeps committing DerivedData folder
  • how to find specific files in (whole) git repo
  • Gitblit push error “error: RPC failed; result=52, HTTP code = 0”
  • Read-only check if a git working copy is behind its remote
  • How to customize which terminal is used by the “Git Bash Here” command of msysgit's shell extension?
  • Loading a library in Gradle using JitPack
  • 3 Solutions collect form web for “Difference between alias and branch in git”

    [alias] is your Primary remote repository‘s alias. And [branch] is your branch name of the project.
    For example, I have a repo(let’s say, yourRepo) on github, and its primary remote repository is git@github.com:user/yourRepo.git.
    You’ll often do

    git remote add origin git@github.com:user/yourRepo.git  

    to add it to your local repo. Then you can push your update to github by

    git push origin master

    Here origin is often used as alias for primary remote repository.

    There’re still some other type of alias for git. For example, you can do

    git config alias.com commit

    to make com alias to commit. The alias here is not the [alias] in your question. I just mentioned it by the way. Maybe you’ll like it. 😉

    By alias I think you mean repository?

    So a typical command you’d run might be git push origin master. Where origin is the name of the repository you are pushing to and master is the branch name to push.

    You can create your own aliases for branches. If you feel for it, you can make an alias for the master branch called sweet-mother-of-god.

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