Difference between repo start and git checkout -b

Doing some work in the Android Kernel. I am very familiar with git, but not extraordinarily familiar with repo, so I read the following document: http://source.android.com/source/version-control.html. To my understanding from it, as well as experimenting around with topic branches, repo start BRANCH_NAME is the same as git checkout -b BRANCH_NAME. Am I correct in my understanding, or are there some subtle, important details that I am missing?

  • Learning resources for Android Open Source Project (AOSP)
  • Save space when downloading Android source
  • How to use git bash in windows for cloning an Android project
  • alternative to git-repo ( aosp repo )
  • repo/git revert to state as one month ago
  • Where can i browse the Android 2.2 Froyo source of java.lang.String?
  • git merge conflicts with our database file (multiple developers)
  • pre-push git hook?
  • How to deal with merges of topic branches after a squashed merge of parent
  • Is it possible save my latest commit (changes) into a directory ? How?
  • Git on a hosted remote server. What do I need from my host? What do I need to know?
  • How to use multiple ssh keys for multiple gitlab accounts with the same host
  • 2 Solutions collect form web for “Difference between repo start and git checkout -b”

    Looking at the start.py source code for repo start, I believe the main difference is in the management of the manifest files which are included in Android projects.

    begins a new branch of development, starting from the revision specified in the manifest.


    To add to Trevor Johns’ answer, you need to check “How do you make an existing Git branch track a remote branch?” (when you are not using repo start):

    git checkout -b newBranch -t aosp/master
    

    That will set remote and merge (-t = “track”) in the config associated to the new branch.

    A simple git checkout -b wouldn’t set anything, and create a purely local branch (without tracking any upstream branch to a remote repo)

    The difference is that repo start sets the remote and merge properties for your branch inside of .git/config:

    [branch "YOUR_BRANCH_HERE"]
        remote = aosp
        merge = master
    

    Without these, repo won’t know how to properly upload your change when you run repo upload later, and it will act as if your new branch simply doesn’t exist.

    (There’s also some logic in there that lets you create the new branch for every project in the repo simultaneously with --all, but that’s just a convenience thing.)

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