jenkinsci / jenkinsci/git-plugin

[JENKINS-27625] Git submodules, option for reseting local changes on submodules

Open
#2,633 2 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

When working with submodules and submodule modifies some tracked files during build,

the consecutive builds will file on submodule update, with a git error of unstaged changes.

Although build should not change tracked files it could happen due to programmer mistake.

One can bypass it with

git submodule foreach git checkout %sha1%

as a first build step

Note that git clean is not an option for builds that uses bower or npm, since they download packages from web, and generally work very long.

---
Originally reported by fantastory, imported from: Git submodules, option for reseting local changes on submodules


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 4
  • imported: 2025-12-02

Raw content of original issue

When working with submodules and submodule modifies some tracked files during build,
the consecutive builds will file on submodule update, with a git error of unstaged changes.

Although build should not change tracked files it could happen due to programmer mistake.

One can bypass it with
git submodule foreach git checkout %sha1%
as a first build step

Note that git clean is not an option for builds that uses bower or npm, since they download packages from web, and generally work very long.

environment

```
windows 2012R2

Jenkins ver. 1.605

GIT client plugin 1.16.1

GIT plugin 2.3.5
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.