DEV Community

Cover image for Which git commands do you struggle with?
Ben Halpern
Ben Halpern Subscriber

Posted on

Which git commands do you struggle with?

Which git commands and concepts do you have a hard time wrapping your head around and using regularly?

And with the commands you struggle with: Do you use them despite your difficulties or do you generally avoid them?

Source of the cover image. ๐Ÿ˜„

Latest comments (45)

Collapse
 
csgeek profile image
csgeek

git-filter-branch is very cool to re-write entire history and reflog which lets you undo certain "oops" moments.

I wish I understood both of them better.

Collapse
 
bizzibody profile image
Ian bradbury

All of them.

Collapse
 
polterguy profile image
Thomas Hansen • Edited

Jeff Bezos has a rule; "Two pizza should be sufficient to comfortably feed a software development team". So what on earth does this has to do with git you may ask?

Well, if your git branches ends up looking like a x-mas tree, or guitar hero (LOL!), this is a symptom of complexity, often originating from the size of your team, resulting in that you've got too much "administration overhead". People that initially sees Magic's source code, are often shocked to see the sheer number of projects (40+), without realising that by segregating its projects to such an extreme extent, it's much easier to segregate teams into smaller more easily managed chunks of code, again resulting in that you can create smaller autonomous teams, not interfering with each other, making it easy to "feed each team comfortably on 2 pizzas".

Conclusion? If your git branches looks like "guitar hero", you're probably doing something wrong elsewhere in your organisation. Rethink the way you're working, find the underlying symptom, and watch your "x-mas tree automatically turn into a Redwood tree" ... ;)

Collapse
 
fabianaasara profile image
Fabiana Asara • Edited

git-rebase is still a mystery to me ๐Ÿฅฒscared to even use it

Collapse
 
joelbonetr profile image
JoelBonetR ๐Ÿฅ‡ • Edited

I use GitKraken Pro, I'm not a peasant ๐Ÿ˜‚๐Ÿค—

Collapse
 
tonyknibbmakarahealth profile image
TonyTheTonyToneTone
> commit
Enter fullscreen mode Exit fullscreen mode

It always wants me to write a comment.

Collapse
 
vinayvinay profile image
apssdcvinay

I struggled with git rebase a lot of times

Collapse
 
androizer profile image
Akshay Mahajan

Alot of common git commands are ok to grasp like merge, rebase, cherry-pick, reset etc. But the command I think I currently struggle upon is interactive rebase when people who don't understand where rebase excel and ruin the history with alot of merge commits.

Collapse
 
garrettmills profile image
Garrett Mills

A lot of submodules stuff feels... suboptimal for end-users. One that gets me occasionally:

  1. Clone repo with submodules & initialize submodules
  2. Edit file in a submodule and commit/push it
  3. Commit disappears into the ether.

This is because submodules check out a detached head instead of a branch, so committing on top of the head doesn't make the commit the new head of the branch... so next time you pull it disappears.

Collapse
 
ytjchan profile image
ytjchan

Can git reflog show the commit hash?

Collapse
 
ameliagapin profile image
Amelia Gapin

I will NEVER grasp submodules. Every time someone at work brings them up as a suggestion, I run away

Collapse
 
jwp profile image
JWP

Visual Studio Code has a plug-in named GitLens. It is so good that I don't issue git commands any longer.

It includes rebasing,
auto resetting to any commit, changing the head pointer, full Visual commit history with code drill down ability to see modifications. Not to mention syncing, pushes and pulls, commits and branching.

Collapse
 
mondash profile image
Matthew Ondash

Oh for sure! Interactive rebase with GitLens is the bees knees! And managing branches and stashes has never been easier. Pair it with the Git Graph extension and it's a whole new world :D

Collapse
 
jwp profile image
JWP

It's helped me out of terrible messes I did to my local and remote repos many times.