Git Basics


Adding a file and making commit

git add file
git commit -m 'Message'



git checkout -b myfeature develop


git checkout develop
git merge --no-ff myfeature


git branch -d myfeature

List all branches

git branch -a

Renaming a branch

git checkout development
git branch -m develop ...
more ...

Git Going back

Going back

Revert the changes in uncommited but stagged changes

git reset --hard

Revert the changes in individual files

git checkout file

Simply unstag a file

git reset file.ext

Remove completely from history

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch FILENAME" HEAD

and then

rm -rf .git/refs ...
more ...

Git Remotes


Working with remote repos

Push a local branch to a NEW remote branch changing names

git push origin cloropetas_vectores:feature/coropletas_vectores

Track an existing remote branch to an existing local branch

git branch --set-upstream cloropetas_vectores origin/feature/coropletas_vector
more ...

Git Tags


Tagging is useful because you can checkout a tag

git tag -a v1.2

Getting a particular tag

After the clone, you can list the tags with

git tag -l

and then checkout a specific tag:

git checkout tags/<tag_name>

Delete a remote tag

Just push an empty reference ...

more ...