Git console / gitbash – basic console commands

#show commit history
git log

#list files modified on a certain commit
git diff-tree --no-commit-id --name-only -r commit-hash

#list files modified within last 30 days
git diff --name-only "@{30 days ago}"

#list remote branches 
git fetch 
git branch -r 
git ls-remote --heads 
git remote show origin

git branch -vv # list local branches

git checkout -b BRANCHNAME # create a new branch and switch to it
git push --set-upstream origin BRANCHNAME # push your new branch to remote repo

git checkout BRANCHNAME    # switch to a branch BRANCHNAME
git push origin BRANCHNAME # push your branch to github

#merge master branch into feature branch
git checkout F1 # switch to branch F1
git merge master # merge from master branch

# completely remove all staged and unstaged changes to tracked files
git reset --hard

#config
git config --list
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

#if git is tracking files that should be ignored by .gitignore
git rm -r --cached .
git add .
git commit -m "fixed untracked files"

git branch -d branch_name    #delete local branch
git push origin --delete dev #delete remote branch