Skip to content

Commit

Permalink
Update all submodules to latest commit on origin
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelazaroff committed Oct 2, 2024
1 parent 78cf3d2 commit bff6c64
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions git/update-all-submodules-to-latest-commit-on-origin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Update all submodules to latest commit on origin

I use [Git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) in a bunch of projects, and one common task is checking out the latest commit on the origin.

Since Git 1.8.2 this is a one-liner, but I'm always forgetting it, so here it is:

```sh
git submodule update --remote --rebase # or `--merge` if you swing that way
```

The answers to [this StackOverflow question](https://stackoverflow.com/q/5828324) have some more detail (including a command that works on earlier versions of Git).

0 comments on commit bff6c64

Please sign in to comment.