Git is an excellent safety net to give you another chance in your wrong move. In this article, I have outlined the mistake scenarios you can get tangled with and the Git techniques that will unwound you from your mistakes. Git can unlock the previous commit and allow you to add your new file.
Table of contents
1. Stop tracking a tracked file2. Modify the Last Commit3. Modify the Last Commit Message4. Discarding all Changes in your working directory5. Discard all changes made to a file6. Restore a file to an old version back in time7. Recover a deleted file(previously committed)8. Discard all changes in your local repo to exact state in remote9. Delete Untracked Files10. Switch a commit to a different branch11. Resurrect a deleted branch12. Rewind/undo an erroneous commit13. Undo a Git Merge14. Rollback to an older version15. Modify an old commit message16. Delete an old commit17. Edit an old commit to add new change(s)1 Comment
Sort: