Email or username:

Password:

Forgot your password?
Top-level
Julia Evans

@jnareb yeah i understand what the refspec does in theory but what I don't understand is -- does ANYONE understand the syntax for the refspec and change it from the default? why? is it worth my time to try to understand more deeply than "yea it's some nonsense just ignore it”?

3 comments
Jakub Narębski

@b0rk I use it to push **all** my local feature branches to remote with `git push origin :` - here `:` is a special kind of refspec

Before `git push` got `--delete` option it could be used to delete branch in remote repository with `git push origin :branch-to-delete` (push empty into branch).

If GitHub/GitLab/... is configured so that 'main' branch is protected and you cannot push there, you can use `git push origin main:other-name` and then create pull request/merge request.

Not usual cases.

Jakub Narębski

@b0rk Also, I think if you want to share git-notes (for example to add information to existing commits, such as that it was the cause of the bug, and was fixed later), or git-replace (which can be used to connect current history with historical repo converted from some other SCM), you need to hand-craft refspec - as they both use references which are not branches.

git-scm.com/docs/git-notes
git-scm.com/docs/git-replace

Go Up