Skip to Content

Git Notes for When My Brain Forgets Git (Again)

I use Git constantly, I also forget Git commands constantly.
26 January 2026 by
Git Notes for When My Brain Forgets Git (Again)
All Things Toasty Software Ltd, Austin Welsh-Graham
| No comments yet

Instead of maintaining yet another notes.txt file that will rot on my computers, this post exists so that when future me forgets forgets again, I can take them from here.

If you spot something wrong, missing, or better: feel free to let me know, technology is complex, my brain is shallow.

Basic Git Commit Flow (I Sometimes Remember These)

When in doubt, it's usually just this.

1. Add changes

git add .

2. Commit

git commit -m "Preferably a meaningful commit message"

3. Push

git push

That's usually it.

Backdating Git Commits (It Happens)

Sometimes you forget to commit yesterday. Sometimes timeline matters. Git allows it.

1. Add changes

git add .

2. Commit with a custom date

GIT_AUTHOR_DATE="yyyy-mm-ddThh:mm:ss" \
GIT_COMMITTER_DATE="yyyy-mm-ddThh:mm:ss" \
git commit -m "Your commit message"

3. Push

git push

This changes both the authored date and the commit date. If you don't do both Git might snitch.

Adding a Submodule

Submodules are powerful. They are also a source of pain and forgetfulness.

1. Add it

git submodule add https://github.com/username/repo path/to/repo

Any other valid Git repo link will work.

2. Commit and push it

git commit -m "Add submodule path/to/submodule"
git push

Removing a Submodule (The Right Way)

You can't just delete the folder sadly. Git remembers.

1. Deregister the submodule

git submodule deinit -f path/to/submodule

2. Remove it from the index

git rm -f path/to/submodule

3. Remove submodule metadata

rm -rf /git/modules/path/to/submodule

4. Commit and push it

git commit -m "Remove submodule path/to/submodule"
git push

5. Sanity check

git submodule status

If it's gone, you're free.

Converting a Submodule into a Normal Folder

Sometimes submodules stop being worth the effort. This is how you flatten one.

1. Remove submodule internals

git submodule deinit -f path/to/submodule
git rm --cached path/to/submodule
rm -rf .git/modules/path/to/submodule

2. Re-add it as a normal directory

git add path/to/submodule

3. Commit and push

git commit -m "Convert submodule to regular directory"
git push

Now it behaves like a normal folder. Sanity restored.

Updating a Submodule (Pulling Changes)

When the submodule repo has moved on and you want the latest version.

1. Pull updates

git submodule update --remote --merge

2. Add the updated pointer

git add path/to/submodule

3. Commit and push

git commit -m "Update submodule(s)"
git push

Updating a Submodule (Pushing Changes)

When you made changes inside the submodule.

1. Enter the submodule

cd path/to/submodule

2. Commit and push inside it

git commit -m "Submodule updates"
git push

3. Go back to the root repo

cd ../..

4. Commit the pointer update

git add path/to/submodule
git commit -m "Bump submodule pointer"
git push

If you forget this last part, nothing updates upstream.

Notes

I'll try and update this if I ever need to make use of any more of Git's features.

Git Notes for When My Brain Forgets Git (Again)
All Things Toasty Software Ltd, Austin Welsh-Graham 26 January 2026
Share this post
Archive
Sign in to leave a comment