I wanted to know what the difference is between discarding a file and and stop tracking a file in git using source-tree. If I deleted a file in my updated code and I want that file deleted on the repository too should I mark it as stop tracking or should I discard it during the commit process
suo file storing Visual Studio settings that you decide shouldn't have been in source control) but remove it from the repository, you should use Stop Tracking. After this, if you see the file listed in Unstaged files, you can use right-click > Ignore... in SourceTree to update your .
On SourceTree for Windows, right click the files you want to discard (in the Working Copy Changes list), and choose Discard. On git, you'd simply do: git reset --hard to discard changes made to versioned files; git clean -xdf to erase new (untracked) files, including ignored ones (the x option).
Using git rm to Stop Tracking Files in Git This will remove the file or folder, as specified, from tracking (i.e.) remove it from the index; but will not delete the file from the filesystem.
The one detail not covered by the first answer is that Stop Tracking does not delete the local file. It only removes it from source control.
In SourceTree, selecting "discard" on a file just throws away your local changes; stop tracking removes it from the repository. However, as long as you have deleted the file on your local drive, and you can see that deletion in the "Staged Files" section of SourceTree, it will be deleted in the repository as well when you commit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With