Can You Git It?
Tags: git, versioncontrol, ide, development
Published: 2022-02-12 04:29:59

What is Git? Why do you always face issues when trying your hand at Git commands? This blog tries to make it, make sense. 

![Git logo](https://media.giphy.com/media/kH6CqYiquZawmU1HI6/giphy.gif)


Not to be mistaken with [GitHub](https://en.wikipedia.org/wiki/GitHub), a host for software development and version control using Git.[Git](https://www.atlassian.com/git/tutorials/what-is-git) is the most popular modern version control system used by developers today.

Developed in 2005 by Linus Torvalds, Git is actually an actively maintained open source project. Why does that name ring a bell? Well, Torvalds is the creator of the well-known operating system kernel, Linux.

###Hard to Git

![Developer dances out Git commands](https://media.giphy.com/media/cnhpl4IeYgU7MCBdV2/giphy.gif)


Now, what would you say are the most [common issues](https://www.geeksforgeeks.org/common-git-problems-and-their-fixes/) you face when using Git are? 

- Clean local commits 
- Undo local commits
- Remove a file from Git without removing from the file system
- Reverting pushed commits 
- Avoid repeated merge conflicts 
- Find a commit that broke something after a merge 


![Two sides at war clashes with each other personifying Git merge](https://media.giphy.com/media/cFkiFMDg3iFoI/giphy.gif)


I came across this helpful cheat sheet from a _Slack_ channel which I've been meaning to print out and stick on the side of laptop until I memorize it. Also, if anybody knows the source of where it came from, please let me know: 

![Git Cheat Sheet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cab5j23ajvq532ji1zte.jpg)

A few commands not mentioned on the list are (not the greatest list in retrospect). Let's remake a personalized cheat sheet of what commands you would use often: 

- [`git status`](https://www.atlassian.com/git/tutorials/inspecting-a-repository#:~:text=The%20git%20status%20command%20displays,regarding%20the%20committed%20project%20history.): Displays the state of the working directory and the staging area
- [`git log`](https://careerkarma.com/blog/git-log/#:~:text=The%20git%20log%20command%20displays,message%2C%20and%20other%20commit%20metadata.): Displays a record of the commits in a Git repository (add log # to list out specific log, press the "D" button to scroll down) 
- [`git diff`](https://www.atlassian.com/git/tutorials/saving-changes/git-diff#:~:text=git%20diff%20is%20a%20multi,%2C%20branches%2C%20files%20and%20more.&text=The%20git%20diff%20command%20is,state%20of%20a%20Git%20repo.): A multi-use Git command that when executed runs a diff function on Git data sources (add log # to access that specific log) 
- You can add `relative path just public` to the command for example, to locate a file or folder on a file system starting from the current directory
- [`git stash`](https://www.atlassian.com/git/tutorials/saving-changes/git-stash#:~:text=git%20stash%20temporarily%20shelves%20(or,re%2Dapply%20them%20later%20on.): Temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else 

Check out other handy Git commands that we might not know of [here](https://www.youtube.com/watch?v=wnYL4yUd-z0). 

Clearly, we all need a Git refresher course, and thanks to FreeCodeCamp [this](https://www.freecodecamp.org/news/git-for-professionals/) is comprehensive one. 


###Conclusion 

![Jimmy Fallon goes country](https://media.giphy.com/media/hs1wBxNGuR7z2LyzHT/giphy.gif)

As they say, the best way to get better at something is by practicing. Until then, I hope this can be a form of reference whenever you forget what Git command to use.