News for hackers. Stuff that matters.
Re:Git 2.19.0 released by saidajigumi on Wednesday September 12, 2018 @12:10PM (#17970205)
In a script called `git-first-push`, on your path:

    #!/bin/zsh

    git push -u ${1:-origin} HEAD:"$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')"

This means "push the current branch to origin (or the first argument, if specified) to a branch of the same name, when this hasn't been done before. Set origin (or the first arg) as the upstream of the local branch". Formally invoked as `git first-push [remote]`, I just alias it to `git fp`.

EDIT: I've forgotten offhand whether there are actual zsh-isms here. It's probably bash compatible, but I always have zsh installed by the time this script lands on a system.

Re:Git 2.19.0 released by phamilton on Wednesday September 12, 2018 @12:31PM (#17970441)
how is this different from:

    git push -u origin head

?
Re:Git 2.19.0 released by saidajigumi on Wednesday September 12, 2018 @01:51PM (#17971214)
Good point; I'd missed that someone taught git a smarter "spelling" for this task. IIRC, `git push -u origin HEAD` didn't used to automatically create a branch of the same name on that remote -- the explicit colon notion was required. I've had this little script around for a long time...
Re:Git 2.19.0 released by majewsky on Thursday September 13, 2018 @02:50PM (#17981275)
I just do

  git push -u
which does what I want since I set

  git config --global push.default=current