Snippets
Git
Update .gitignore
After you have updated your .gitignore file you need to reset git to track the correct files.
git rm -r --cached .git add .git commit -m "Update files after change in .gitignore"Consistent line-endings
To keep the line-endings in text files consistent, add an .gitattributes with the following content to the root of your repo. This will make sure all text files keep their unix line endings except for the ones specified.
* text=auto eol=lf*.{cmd,[cC][mM][dD]} text eol=crlf*.{bat,[bB][aA][tT]} text eol=crlfIf this is done to an existing repo, make sure to reset all files with:
git rm --cached -r .git reset --hardUndo the last commit
Did you accidentally commit your changes to the wrong branch? If you still haven't pushed, it is no problem just undo it (the commit will be undone but your changes will remain).
git reset --soft HEAD~1