git
Git refuses to reset/discard files
make sure:
git config --global core.autocrlf falseyou don't have a .gitattributes file with eol directives that would try to convert the end-of-lines.
git rm --cached -r .(Remove everything from the index.)git reset --hard(Write both the index and working directory from git's database.)
warning: current Git remote contains credentials
warning: current Git remote contains credentialsThis is from git-lfs. Because origin url contains access token, e.g. https://abc:@dev.azure.com/abc/def/_git/def
Solution:
do not use git-lfs
use
git -c http.extraheader="AUTHORIZATION: bearer $accessToken" fetch;and
git -c http.https://[email protected]="AUTHORIZATION: bearer $accessToken" lfs fetch;
do not use git tags
Why?
tags can be deleted/added/renamed at any time against any commit;
fetching git tags will cancel out the effect of sparse-checkout;
git clean -ffdx
git clean -ffdxRemove all extra folders and files in this repo + submodules
This gets you in same state as fresh clone.
source: https://stackoverflow.com/a/42185640
why double f?
Git will refuse to modify untracked nested git repositories (directories with a .git subdirectory) unless a second -f is given. (https://git-scm.com/docs/git-clean)
blame a deleted line
git log -S path/to/file
e.g.
git log -S "var a = 0;" UnitTest.cs
Last updated