-
Create a git repository:
git init
-
Add files to the repository:
git add [filename or "--all"]
-
Committing the added files:
git commit
-
Branches:
-
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]
-
Tags:
-
"Annotated" tags:
-
Create an annotated tag:
git tag -a v0.1 -m "Initial prototype"
-
List tags:
git tag
-
Show the comment of the annotated tag:
git show v0.1
-
"lightweight" tags:
-
Create the lightweight tag:
git tag v0.1
-
Roll back to a specific tag:
git reset --hard v0.1
-
Delete a file from GIT's history:
git filter-repo --invert-paths --path <path to the file or directory>