DEV Community

Discussion on: Which git commands do you struggle with?

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
 
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
 
ytjchan profile image
ytjchan

Can git reflog show the commit hash?