Git command line tips and tricks

Push all to GitHub

git add -A
git commit -m "first commit"
git push origin master

Git stop tracking files

git update-index --assume-unchanged [path]

Git add untracked files

git update-indx -h
git update-index --no-assume-unchanged [path]

Undoing a git push

git push -f origin last_known_good_commit:branch_name

Nuke last commit and never see it again

git reset --hard HEAD~1

Reference:

  • https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-commits-in-git
任何人生疑惑,请找 海云青飞 https://www.tuenhai.com