Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Git Push

Git has a default setup for where it plans to perform the push. This is the push.default.

The push.default contains the refspec.

Refspec

The refspec maps a local branch to a remote branch.

This is inside of .git/config

[remote "origin"]
        url = git@github.com:ariadne-notes/network-notes.git
        fetch = +refs/heads/*:refs/remotes/origin/*

Format of Refspec

This is the fetch line from above.

  • Format: +<src>:<dst>
    • + force update (non-fast-forward allowed)
    • <src> source ref
    • <dst> destination ref

Updating History

Making a change on the remote, to the commit history itself requires force.

The safer way to do this is per-branch, not the entire repo.

git push origin +main

References

Git - git-push Documentation

Git - The Refspec

Last Modified • Sunday, June 14, 2026. 5:09 am UTC+00:00 • Commit: 4a9f867