You will make mistakes no matter what. The worst mistake is not even trying. This document has recommendations for when you made smaller mistakes:
You pushed your mistake to the shared repo
You added a junk file and only added it, but did not commit
You changed stuff, but did not want to commit it
You are completely lost with git
You went all the way and pushed a mistake up to the shared repo. Don't worry. You can rewind, just do it as soon as possible. git log
will show you your last commits with an id has. git revert <commit_id>
will roll the changes back on to the step you put in the commit_id for locally. Now just push your local changes again.
You just added a bunch of stuff you should not have. No worries! Just remove them (like go to the local files on your machines and move them away) then go git status
and start the cycle again.
You just modified a bunch of stuff and you should not have the modifications up on the main repo. When you type git status
you see this and you want to go back. No worries, just git restore <file_name>
You have entered some kind of version-control nightmare or git based mess. Git is telling you to do stange things that make no sense to you. Stop. If you aren't sure what something does, you can go to a different terminal, and type git help
. Follow the instructions.