In Turkish, there's a saying "aman dilemek", which means to plead or beg for something.
Just like we might beg for forgiveness for a mistake, in Git, we "amend" our last bad commit messages to make them right.
Modify the last commit's message:
git commit --amend -m "New commit msg"
then force push :
git push origin <branch-name> --force
or use " Excuse me, may I force? 😊 " version :
git push origin <branch-name> --force-with-lease
When working with a team, using --force-with-lease
helps ensure that you do not accidentally overwrite someone else's work.
Sometimes, curiosity gets the better of us and we tinker with files, only to realize it's not the change we wanted.
Ever felt like you've opened Pandora's box with a file and wished for a quick escape?
Especially with those pesky UI files where manual reversion feels like the stone age.
Before you've added, committed, or pushed, there's a magic spell to revert your file back to its last committed state:
git checkout -- <filename>
Ever been in the middle of some code alchemy and needed to switch gears without committing?
Enter git stash - your workspace's magic cloak. It hides your changes, letting you pivot swiftly.
git stash
But what if you decide those stashed changes were just a wild experiment not worthy of the light of day?
No worries. With git stash drop, you can discard that stash, no strings attached.
git stash drop