DEV Community

Cover image for Git Commands for Software Engineers

Git Commands for Software Engineers

Odumosu Matthew on July 08, 2024

Introduction Git is an essential tool for software engineers, enabling efficient version control, collaboration, and project management....
Collapse
 
webjose profile image
José Pablo Ramírez Vargas

I've been a developer for 2 decades. Why people learn git commands is just beyond me, when there are amazing things like Git Graph in VS Code that does it all graphically. Just me?

Collapse
 
iamcymentho profile image
Odumosu Matthew

Haha, I hear you! Git Graph in VS Code is indeed a lifesaver for visual folks. But hey, some of us still enjoy the thrill of typing mysterious commands into a terminal. Keeps us feeling like coding wizards! 😉✨

Collapse
 
jottyjohn profile image
Jotty John

I second you Odumosu!

Thread Thread
 
iamcymentho profile image
Odumosu Matthew

I'm glad I'm not alone! Thanks for the backup😂

Thread Thread
 
martinbaun profile image
Martin Baun

Right? It elevated my programming skills and also pleased the code gods?

Thread Thread
 
iamcymentho profile image
Odumosu Matthew

Definitely! Mastering these tools can really take your programming skills to the next level. It's like earning the favor of the code gods and becoming a true maestro of development. Keep up the great work!

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas

I can't tell if you're serious or sarcastic. I hope the latter because knowing these serves no such purpose. For this to be true, programming would have to be about who knows the most command lines.

Thread Thread
 
iamcymentho profile image
Odumosu Matthew

Haha, fair point! It's definitely more about how effectively you use the tools you have rather than knowing the most command lines. But hey, a little command line knowledge never hurts—just adds a bit of flair to your toolkit!

Collapse
 
pratik_gupta_3744c37064a8 profile image
Pratik Gupta

I Am Supporting this guy

Collapse
 
ilya-chumakov profile image
Ilya • Edited
  1. CLI is faster (sometimes).
  2. It opens the way to automatization.
  3. Once learned, Git commands stay. In any environment, on every OS supported. No vendor lock-on.
  4. GUI tools usually support only a subset of CLI capabilities.

Btw, can Git Graph handle interactive rebase?

Disclaimer: I use GUI regularly, but knowing CLI is a nice addition to that.

Collapse
 
webjose profile image
José Pablo Ramírez Vargas
  1. Yes, Git Graph has rebase.
  2. CLI is only faster if you decide to learn the commands. Otherwise it is infinitely slower.
  3. Nothing wrong in not having all functions in GUI. We never need 100% of all functions everyday. The gain is in sporadic days and therefore this has very little impact.
Thread Thread
 
ilya-chumakov profile image
Ilya
  1. You know the difference between rebase and rebase --interactive, don't you? As I see, Git Graph can't do the latter. This is the issue 5 years from now and it is still open github.com/mhutchie/vscode-git-gra...

  2. Yes, you learn it and then enjoy the speed. Nobody rejects driving because of they would have to spend some time on obtaining a license.

  3. I want GUI to help me in complex cases, not for git commit or git merge.

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas • Edited

So you're saying that because a particular rebase variant is not available, one must ditch the entire GUI tool? I guess No, right?

Aside: Git Graph's licensing prohibits copies and makes collaboration on the project difficult. There are many issues that are pending with it. There are, however, other GUI's. Don't fixate on Git Graph. Git Graph is not the object of discussion here.

I'm sorry, but if chauffeurs were free, I bet a LOT more people would forget about getting a driver's license. The same here: Why undergo this effort if <insert-GUI-tool-here> does it for me for free?

GUI's help you in complex cases. Find the right GUI. There is none? Consider creating one and sharing with the world.

Thread Thread
 
ilya-chumakov profile image
Ilya • Edited

I believe nobody in this thread is talking about ditching anything.
You literally asked

Why people learn git commands is just beyond me

And you got the answers. Nobody said you must do anything, really. However, I see no problem in learning something new to become more productive.

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas

Fair enough. I'll ammend: "Why people learn the entirety of git commands...". I'm not against learning a particular something that you need when your need isn't cover elsewhere. I just see learning all of them for the sake of learning them as a crazy thing to do, simply put.

Collapse
 
welshapple profile image
William

Congratulations on having 20 years experience and bragging about your clear laziness.

People like you are awful to work with. The amount of "developers" who "know version control and git" and are just glorified button pressers is staggering. I've had countless developers in my jobs that ask me to hold their hand through every merge. Its tiring. Just learn how to pull, push, merge, branch, and you're golden? Its like 10 commands.

Or you can continue to use a GUI and cry when errors occur because you have no idea what's going on underneath the hood.

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

LOL! Someone's got some anger issues. Bro, everything all right at home? Need me to call someone?

Thread Thread
 
welshapple profile image
William

Do not confuse my passion with anger.

There are many new developers who use this forum and are impressionable. Your comment could deter them from learning a very simple and incredibly valuable skill.

Skills that are transferrable. Skills that could lead to a higher salary and better life. But sure call someone if you like. I'm always happy to meet new people and experience new things.

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas

I have never, not ONCE, been asked in a job interview: "Do you know GIT command lines? No, sorry, I can't hire you!" LOL

You are delusional if you think knowing GIT commands matter one bit when it comes to salary or better life.

Get some help because passion does not require INSULTING other people. Or maybe a dictionary?? Either is good for you.

Thread Thread
 
welshapple profile image
William

Hey you've insulted me just as much as I have you. If it's too much perhaps don't share your opinion on developer forums?

I never said Git commands = more money. I said its easy to learn, and as its a CLI, the exposure to the command line will help when using other CLIs.

You know how as a developer we have to use CLIs quite frequently? You even have posts about Vite in your profile.

These things are easier to learn when you have previous experience. And as you learn these things you become a better developer and earn more money. Its not that difficult to understand. But sure keep changing the goal posts of the discussion to fit your narrative.

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas

Hey you've insulted me just as much as I have you.

Don't confuse MY passion, bro! :-)

If it's too much perhaps don't share your opinion on developer forums?

Now because my opinion hurts you I must refrain from posting? How about you, perhaps, not reading my posts?

You don't need to learn GIT commands to "practice" for other command lines. This is just a memory exercise, and you've been doing them since you were in school.

But sure keep changing the goal posts of the discussion to fit your narrative.

What's my narrative here, exactly?

Thread Thread
 
welshapple profile image
William

Sorry I'm not going to continue this discussion when you clearly don't understand what a transferrable skill is. And I also think there is a slight language barrier which I can only respect you for, I couldn't discuss this in your language.

To any new developers reading this I implore you to learn the basics of git commands. Even if you then go onto use a GUI, that's fine. But getting to grips with what is going on behind the scenes is invaluable.

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas

No problem. You clearly don't understand the lack of importance learning GIT commands has, so we're at an impasse anyway.

Tip for future instances: Keep your "passion" in check. :-)

Collapse
 
matfire profile image
Matteo

Honestly ?

  • because it's easier to use on any environment. Let's say, for example, that I need to pull new changes on a server. If I wanted to use a GUI, I'd need to setup forwarding to my machine, install all of that etc. (this is just for one server, imagine having to do all that for 3 or more).
  • Another point is that it's usually faster to use a keyboard than a mouse (though some GUIs have keyboard shortcuts, so I guess it depends)
  • It's also the only way to do some more esoteric stuff with git

Also, it's usually good to know what a GUI does under the hood and yes - you don't need to use the cli - but it cannot hurt to do so :)

Collapse
 
webjose profile image
José Pablo Ramírez Vargas
  1. Servers can be remotely updated via a share, for example. Do you think I have never worked with servers? Yet, I have never had the problem you describe.
  2. The keyword being "esoteric". Means they are rarely needed. Meaning: Why you would invest into learning everything when you only need the esoteric ones once every blue moon?

Nobody has come up with a solid reason so far. Come on, guys!

Collapse
 
thanh_nguyenduc_d7507fb2 profile image
Thanh Nguyen Duc • Edited

Because when you interact with git through the GUI, if for some reason an error message is returned, you are not sure which git command you are executing is faulty, which leads to wrong judgment. Moreover, if you use the git command, you can have complete control over the source code, and can execute advanced git commands that the GUI does not support.

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

Excellent theoretical reply. In practice, I have never once lost any amount of "control" over the source code by using a GUI, and the GUI has never precluded my ability to run a GIT command in the very, extremely rare case that I have ever needed something that the GUI doesn't provide.

So yes, your answer is very solid, but doesn't describe the reality of things. Reality is that 99.9% (or more), GUI tools work perfectly and have every feature that you need. I won't go through the painful exercise of learning all of these commands to cover the 0.1% of the cases. Practicality, my friend. 😄

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

For some reason, Rense Bakker is afraid of my responses and have blocked me. Anyway:

Rense, learning GIT !== learning GIT CLI. I know enough of GIT not to make fatal errors like rewriting histories, so I disagree with your comment: One can destroy a repository with the CLI just as easily by reading quick descriptions of the commands and then hastily deciding on one that you think solves your problem and boom!

One can learn GIT and that doesn't imply learning the CLI as well.

Collapse
 
litlyx profile image
Antonio | CEO at Litlyx.com

Because CLI is better always!

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

Explain how it is better in every instance.

Thread Thread
 
ezpieco profile image
Ezpie

one word... neovim.

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas

Searched for it. Sounds like another instance of learning dozens of things. This time, keyboard shortcuts. Yes, that's not as bad, so cool. That's, however, one instance, not every instance.

Thread Thread
 
ezpieco profile image
Ezpie

Yeah you may have to learn keyboard shortcuts, if and only if you don't know how to configure something, all you need to do is read some docs and create your own custom keyboard shortcuts, and now rather then following the standard shortcuts, you can just type what ever shortcut you created and voila! Neovim can be configured all around, now I know VSCode can also be, but tell me, from what angle can you configure it to be fast? Try loading a monorepo in VSCode, that uses TS, Docker, terraform, AWS Lambda, and a whole lot of stuff, adding up, VSCode takes like literally 1 - 2 min to load, plus if you use something like a laptop then it's even more hectic, now with neovim, you can configure it to a huge extend, I tried and I can guarantee you that it took a crazy 1 sec to open a file.

This is because of neovim's nature, it can be configured like VSCode I agree, but because it's directly compiled to machine code it executes faster, VSCode is written in TS, so first it has to compile to JS and then to machine, neovim has minimalistic packages, which are written in lua and not TS or JS, which makes it even more faster, due to the fact that all VSCode extensions are written in TS(majority of them) and thus take more time to load.

Now of course you will need to learn some basic shortcuts, but does are usually easy and you can configure them to be something else, you don't really have to worry much about the learning curve, if you really don't want much, you can just ask GPT, which is the worst option to pick, to give you a neovim configure for what all shortcuts you may want.

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas

I see. Thanks for the rundown. Sounds like a good experience, if you can get past the learning of the shortcuts. Maybe I'll check it out later. Cheers.

Thread Thread
 
ezpieco profile image
Ezpie

Yeah you should, not only will you get blazingly fast, you will soon realize that "An idiot admires complexity and a genius admires simplicity" Of course I did not say that. Terry Davis did.

Collapse
 
brense profile image
Rense Bakker

I've seen a lot of fuckups with git GUIs because people don't realize the commands it's doing in the background...

Collapse
 
ezpieco profile image
Ezpie

As a neovim lover... VSCODE IS SLOW AND USES 50% OF YOUR CPU!

No offense it's just for the memes.

Collapse
 
syeo66 profile image
Red Ochsenbein (he/him) • Edited

Some people are simply faster using the cli, and/or don't like VSC.

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

Fair point, but they are only faster because they decided to learn the commands in the first place. Furthermore, what job role do they have to have the need for speed up to the point of going through the pain of learning dozens of commands? I can only see this making sense for a dev ops.

Thread Thread
 
syeo66 profile image
Red Ochsenbein (he/him)

At some point I realized I can do almost everything faster if I don't have to touch the mouse anymore. So, learning those things took me maybe a day, but saved me way more across all the years I'm doing that now. Not only 'git' though, but really almost everything I'm working on now... neovim, tmux, i3 and many other tools allow me to work almost at the speed of my thoughts.

Collapse
 
ezpieco profile image
Ezpie

That's just me using neovim, so yeah as a pro neovim user, I can assure you that jjjjkkkk is faster then using the mouse.

Thread Thread
 
syeo66 profile image
Red Ochsenbein (he/him)

You mean 4j4k... :-D

Thread Thread
 
ezpieco profile image
Ezpie

yeah sure, that works too, but saying jjjjkkkk is far more beautiful

Collapse
 
morgboer profile image
Riaan Pietersen

Agree Jose.. feels like a superfluous flex. Another great tool is GitEXT. It looks like it's straight out of windows 98, but it works a treat. Couple if with KDIFF3 and there's zero guesswork to do.

Collapse
 
iamcymentho profile image
Odumosu Matthew

GitEXT and KDIFF3 are fantastic alternatives for those who prefer a more visual approach. It's all about finding the tools that make your workflow smoother and more efficient. Different strokes for different folks! 👍🛠️

Collapse
 
nnnirajn profile image
Niraj Narkhede

Thanks for sharing !

Collapse
 
iamcymentho profile image
Odumosu Matthew

You're most welcome !

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

I've been a Windows user and fan for pretty much all my adult life. I hate CLI's for things I do myself. Sure, I do CLI when I do, say, GH actions and of course they are the only way to script things. I just say that, personally, Windows exists so my brain can forego many of these.

Collapse
 
skipperhoa profile image
Hòa Nguyễn Coder

thanks pro

Collapse
 
iamcymentho profile image
Odumosu Matthew

You're most welcome !

Collapse
 
amanmishra profile image
aman mishra

Thanks