I recently learned about how to keep a repository of my current website and rollback whenever I mess up with my commit. I keep experimenting a lot with my website and sometimes these experiments mess up my website. These commands will help me retrieve whatever gets messed up.
Git Credentials Manager - Github.com deprecated using ID / Password to login. To enable authentication, they introduced Git Credentials Manger. This utility proved very helpful for me by allowing me to change my devices and still continue accesing Github without the need to remember passwords / username or creating token.
Essential Git Commands:
- initialize existing git repo -- git init
- add changes from local to stage for uploading -- git add .
- committing changes from local to stage for committing -- git commit -m "notes"
- pushing changes to remote -- git push -u origin main
- in case remote is ahead of local and you don't want to merge remote with local -- git push -f origin master
- checking for branches -- git branch (main, master, my-feature)
- changing branches -- git checkout master (will change from active branch to master)
- merging changes from remote to local -- git branch -d my-feature
- git reset --hard old-commit-id - Brings the previous commit into stage. Useful for rollbacks
- git push -f remote-name branch-name - Pushes the above commit into production
- src refspec master does not match any - Error - This means that the remote repository is not available
Category | HTML / JS / CSS |
Credits | NA |
Date | February 4th, 2025 |
Codepen | NA |