Вопрос

When using "git submodule" I get myself into a new problem I have .gitmodules file within my git project "mainproject"

[submodule "subsystem1"]
  path = subsystem11
  url = /mnt/gitrepos/subsystem1.git/

Starting in my main project I did

$ cd subsystem1
$ git pull origin master

Lets assume that something is really wrong now in "submodule1". I got many updates in, that I did not like to have (right now).

$ cd .. #back in "mainproject"
$ git status  
# On branch master
# Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   subsystem1 (new commits)
#
no changes added to commit (use "git add" and/or "git commit -a")

How can I revert to the version of subsystem1 that I had before pulling?

Это было полезно?

Решение

Since you haven't committed the changes to the submodule in your main project, git submodule update from the parent repo will revert the submodule to its previous state.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top