Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to undo git submodule update

I accidentally checked in a wrong submodule update: ( as part of a bigger commit )

-Subproject commit 025ffc
+Subproject commit f59250

It is already pushed to the remote..

How do I undo this update?

like image 643
Tom Fishman Avatar asked Oct 10 '11 21:10

Tom Fishman


People also ask

What is git submodule update?

A git submodule update will bring the latest commits into your local Git worktree. In this git submodule update example, we'll show you how branches can seem out of sync between your submodule and the latest commit, and how to issue the appropriate git command to update those git submodules with the latest code.


1 Answers

Run git checkout 025ffc in the submodule directory and then git add SubmoduleName; git commit -m 'Some message' in the main directory.

(Remember that checking out a commit through its hash leaves you in "detached HEAD state", meaning that you're not on any branch. So if there already is a branch pointing to 025ffc in the submodule repository, you should check out that branch; otherwise, you'll probably want to create a branch there and check it out.)

like image 196
Aasmund Eldhuset Avatar answered Sep 23 '22 23:09

Aasmund Eldhuset