Clone a repository without getting the entire history Git has a feature that we call Shallow Clone; this allows us to make a clone of a repository without taking in the entire history of commits/logs.
Resetting a git pull from the wrong branch I don't know about you, but this happens to me all the time; I accidentally pull in the wrong branch, curse a bit, call myself some names 🤬, and then apply this fix, which is effortless if you understand the concept well enough.
Discard all changes when discarding is not working Sometimes our setup gets messed up, or we mess it up in such a way that nothing seems to work; in those scenarios, use this command to discard anything you have done to start fresh."
How to show a commit’s patch pertaining to a specific path? When viewing the patch of a certain commit with git show <commit> you’re only interested in a certain part of it, related to a file or a directory.
How to change a file name's capitalization without changing its content? If you have a Windows setup, you must have faced the annoying issue of file name case change. Where you changed the file name capitalization, but it just doesn't show up.
How do you check why a file is not in the git status? Ever had a problem, when you add a new file or make changes to an existing one but it just doesn't show up in git status? We got a solution for you.
How to add staged changes to your previous commit in Git? Forgot to add some files or changes in your last commit? Or remember that last thing you needed to do after you have already committed? We have a solution!
How to add changes in one file to two different commits in Git? Let's say you were working on an update but needed to push some partial code. To do it, you can quickly call the interactive add feature of git and select the portion of code you want.
How to get your changes back after an accidental hard reset in Git? If you made `git reset --hard` by mistake, possibilities are you can still get your commit back, as git holds a log of everything for a few days.
How to change the URL of a remote Git repository? Let's say if you set the origin as the wrong repository URL of your git project, and you want to change the remote URL of the origin to the correct one.