Segfault > IT > Lookups > Git commands
  • Create a git repository:
    git init
  • Add files to the repository:
    git add [filename or "--all"]
  • Committing the added files:
    git commit
  • Creating a branch (current branch won't change - you'll have to perform a checkout after having created the new branch):
    git branch [name of new branch] [source branch]
  • Check in which branch I am:
    git branch
  • Check out a branch (!!TO AVOID COMPLICATIONS CHECK FIRST WITH git status THAT YOU HAVE NOTHING UN-ADDED OR UNCOMMITTED IN THE CURRENT BRANCH!!):
    git checkout [target branch]
  • Merge a source branch into a target one:
    • Check (with "git status") that you have nothing un-added or uncommitted in both source and target branches.
    • Check out the target branch.
    • git merge [source branch]