Basics of git
The Basic Git Flow Diagram:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Usage flow
- Master
protected, nobody touches it until first release
- Beta
Replica of Master, used for canary releases, hot fixes
- Test
Used by testing professional/s to validate the work done by the dev team - (load,stress,performance testing)
- Dev
Almost like a local env, can be on a server or not, devs take responsibility for the ops of this env
- Feature Branches
eg: signup, signin, profile or file upload, authentication/authorization
checkout from dev -> make your changes -> git add (generally specific files) -> commit each feature progress -> pull from your parent (dev in this case) -> solve any merge conflicts if present -> add/commit them again -> push them
Cat Ate My Code:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Some Useful git commands
-
go back to some commit?
- first check the previous git commit history with
git log
- copy the commit hash and checkout to it
git checkout <commit-hash>
-
Accidental Commit, How to remove it?
-
Soft Reset
- Go to some git history, without deleting any of your commits, you can always come back to you current code in time
-
git reset --soft <commit-hash,branch>
-
git reset --soft @HEAD{1}
-
Hard Reset
- Go to some git history but will delete any if your uncommitted code, probably there's no way to get your code babck
-
git reset --hard <commit-hash, branch>
-
git reset --hard --hard @HEAD{1}
-
HEAD~~
go back two commits
-
HEAD ^^
go back two commits
~ is used for single parents, single branch
^ used for multiple parents, in case of parents with merged requests
- once you've reset your base, you can commit again, and push your code to repo using
git push -f <branch-name>
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
TIPS
- Always use ssh method to clone your repos
git stash
can undo all of your work
git stash pop
can bring back that undone work
- make use of
git reflog
- always make notes of your hashes, in case you mess up
- HEAD@{1} means go back to previous commit by 1
- use git-tokens for deployments
- or even deploy keys with restricted perms
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Wrap up
- Git takes care of your code, dont panic
- Always add meaningful commit messages
- Keep Learning
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ