4 ms·
Hub is essential for anyone who works with GitHub repositories, IMO. It gives you, if nothing else, an important shortcut: `hub checkout github.com/repo/pulls/
by fcarraldo 7y ago
Hub is essential for anyone who works with GitHub repositories, IMO.
It gives you, if nothing else, an important shortcut: `hub checkout github.com/repo/pulls/1234` automatically adds a remote, fetches, and checks out the branch of a given pull request. Great for local testing/validation, when needed.
- lervag 7y agoOr, simpler: hub pr checkout 1234
- lelf 7y agoI recently learned that you can do git fetch origin pull/⟨PR id⟩/head:pr-⟨PR id⟩ && git checkout pr-⟨PR id⟩ (but hub is nicer of course)
- cyphar 7y agoYou can do this fairly easily with a git alias without needing to be locked into a GitHub-only client: [alias] pr = !"pr() { git fetch origin pull/$1/head:pr-$1; }; pr" And then do `git pr 1234 ; git checkout pr-1234`. Feel free to add `git checkout` to the alias if you prefer.
- cco 7y agoI might be missing something, but can’t you just `git checkout -b <feature-branch-name>`?