Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Before reviewing this page, you should be familiar with concepts of version control and distributed version control systems. See /wiki/spaces/CONNECTWIKI/pages/8585251 for information and links.

Cloning the Repository

  • How do I clone the CONNECT git repository?

    Code Block
    git clone https://github.com/CONNECT-Solution/CONNECT <desired path>
    


...

  • How do I see all my branches?

    Code Block
    git branch (local only)
    git branch -r (remote only)
    git branch -a (all)
    


  • How do I "switch" to the 3.3.1 branch?

    Code Block
    git checkout 3.3.1
    


  • How do I branch and checkout using one line?

    Code Block
    git checkout -b 3.3.1_foo_bug_fix 3.3.1
    
    

    This is equivalent to:

    Code Block
    git branchcheckout 3.3.1_foo_bug_fix
    git checkout -b 3.3.1_foo_bug_fix
    


  • How do I delete a local branch?

    Code Block
    git branch -d 3.3.1_foo_bug_fix
    


  • How do I create a new "foo" tag on the "bar" branch?

    Code Block
    git checkout bar
    git tag "foo"
    git push origin tag "foo"
    


  • How do I create a new "foo" tag on a specific commit on the "bar" branch?

    Code Block
    git checkout bar
    git tag -a "foo" <commit hash> -m "<tag message>"
    git push --tags
    


  • How do I delete a remote tag?

    Code Block
    git tag -d <tag name>
    git push origin :refs/tags/<tag name>
    


  • How do I delete a remote branch?

    Code Block
    git push origin :<name of branch to delete>
    


  • How do I create a new branch and push to remote?

    Code Block
    git checkout <name of branch to base from>
    git branch <new branch name>
    git push -u origin <new branch name>
    

    The -u switch will automatically configure git to push and pull from the remote branch. You can leave off the -u switch if you don't want git pull to merge the remote branch to your local.

  • How do I see which local branch is tracking which remote branch?

    Code Block
    git remote show origin
    


  • How do I create a branch called 3.2.2_dev based off of a 3.2.2 branch from the server?

    Code Block
    git checkout -b 3.2.2_dev remotes/origin/3.2.2
    


  • How do I work with a tag based off of a branch (e.g. 3.2.2_RC2 tag based off of 3.2.2 branch)?

    Code Block
    git checkout 3.2.2      # checkout base branch
    git pull                # get latest remote base branch
    git checkout 3.2.2_RC2  # checkout tag
    


  • How do I work with a remote branch or other fork of CONNECT?

    Code Block
    git remote add connect_official https://github.com/CONNECT-Solution/CONNECT.git   # Add the repo to your remotes. Arguments are: git remote add <alias> <URL>
    git fetch connect_official                                                        # Fetch the changes so you can pull and checkout
    git remote -v																	  # List all of your remote repositories.
    git checkout connect_official/CONNECT_integration                                 # If you wish to check out the branch entirely
    git pull connect_official/CONNECT_integration                                     # Or if you wish to pull these changes into your own branch instead


...