- Commit locally often
- Create new branches for each feature
Check the status
git status
Check the branches
git branch
git add -A
git commit -m 'commit message’
git push origin master
To make a new branch
git checkout -b new-branch
Go back to master branch and merge
git checkout master
git merge new-branch
And then to delete the branch
git branch -d new-branch
(-d will work if the commits are up-to-date. If not you have to use -D to force the delete)
If I have to force a push
git push origin master -f
Reverting commits
git revert -n HEAD~3..HEAD # prepare a new commit reverting last 3 commits
git commit -m 'commit message'
git push origin master # regular push
If there is a caching issue
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch FOLDERNAME" -- --all
