Yes. I’m a latecomer to the Sierra game (due mainly to an audio hardware driver I had to wait on to be upgraded to Sierra, which finally was updated but probably won’t be updated to High Sierra…), and most developers have probably already run into this problem and have dealt with it accordingly. However, I thought it might be a good idea to capture this here for posterity…
Just this morning, immediately after upgrading to macOS Sierra, I experienced a problem by which Git began incessantly asking for my passphrase. This was an unwelcome surprise to me, but thankfully there’s a reasonably simple fix, thanks to this SuperUser suggestion:
macOS keeps asking my ssh passphrase since I updated to Sierra – Super User
In the latest version of macOS (10.12.2), this is easy to fix. Just edit your ~/.ssh/config and enable the UseKeychain option:
There is no need to change anything else. Now everything works the way it used to work before the latest updates. You do not need to add keys to ssh-agent.
In my case, I couldn’t just edit the config file in question, because it didn’t exist. Therefore, I had to create the config file in my ~/.ssh directory with the information mentioned in the SuperUser post.
Thankfully, after creating the file, re-launching Terminal, and entering my credentials one final time, it seems to have worked and Git is happy again.
This is one of the many git functions I always have to look up, and it always makes me insane at its non-intuitiveness. However, as it is a necessary evil, I thought it useful to capture it here.
Believe it or not, you have to use git push to delete. You heard that right. Stop gawking. Jaw closed.
OK so here’s how you do it:
git push origin :[name of branch]
As a concrete, though perhaps not entirely realistic example:
git push origin :my-awesome-feature
Thanks to the following blogs for their constant assistance in helping me remember (or not remember) this function:
git ready : push and delete remote branches
Yuji Tomita : Git — Delete Remote Branch
Good quick help for using Git from Scott Paul Robertson.
Git in 5 Minutes
Git In Five Minutes Many people consider Git to be too confusing or complex to be a choice for version control. Yet Git considers to grow in adoption, and many interesting things have grown up around it. This document is geared for someone wanted to get started with Git, often coming from a Subversion background. For most basic needs this document will cover 70 to 90 percent of your use.
The document has some nice succinct suggestions, but there is a subtle but very important comment he makes in the last subheading, Sweeping Changes Under the Rug for Later, in which he says:
When moving between branches your local changes move with you. Sometimes you want to switch branches but not commit or take those changes with you.
So you begin to learn that stashing (and committing, too) is a very important concept to learn and use effectively… It’s definitely a paradigm shift from the likes of SVN, but having a local repository and set of local branches that you can work with freely and easily is very liberating.
The problem that I foresee is that going back to SVN will be very difficult and constraining after having been exposed to the power and flexibility of Git!
I found this tip to be very useful for adding a “co” shortcut to Git…
Git Command Shortcuts (aliases) (evanjones.ca)
I’ve been using Mercurial to track my personal development projects. However, Git appears to be more popular, and I’ve needed to use it. The two are very similar, but my biggest annoyance is that Mercurial automatically completes commands using the characters you have typed, so hg st is a shortcut for hg status. Git does not do this by default, but you can add shortcuts with: git config –global alias.shortcut command. Example: git config –global alias.st status. This makes me very happy. See the git aliases documentation on the git wiki for details.