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 “NO-HEAD” statement
  • Android Studio Gradle Builds Slow After Project Added to Git
  • Have sshd forward logins of git user to a (GitLab) Docker container
  • Get a List of all Pushes with Git
  • How can I discover which commits a diff is composed of?
  • Git subtree: Use only subrepository instead of whole repository
  • Importing Gitlab Wiki to new Gitlab instance
  • Is there a place to get the laravel `vendor` folder in one spot?
  • Eclipse 'Unhandled loop exception' on Team > Commit
  • change a git commit already pushed
  • A file was added to git on commit n. How do I add it instead to commit n-m?
  • clone succeeded but checkout failed
  • 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.