Basic Git

Cache credentials

git config --global credential.helper store

Create and checkout a branch

git checkout -b {branch name}

Adding / Removing files to be commited (add to stage)

git add {file}
git reset {file}

Check the changes in the added (staged) files

git diff --staged

Commit with message

git commit -m "Commit description"

Delete a branch, local + remote

git branch -d {branch name}
git push origin :{branch name}

Cherry-Pick without doing commit

git cherry-pick -n {hash}

Get the parent branch of the current branch

git log --graph --decorate --simplify-by-decoration

Stashing changes

git stash # Create Stash
git list

git apply 0 # or
git pop 0 # Remove from stash also

git drop 0
git show 0 # --patch (if needed)

Merge changes from another branch without commit

git merge --squash {}

List branches with and without remote counterpart

git branch -vv # In the right side, the remote branch is shown in [...]

git

Back