GIT-HUB(1)
okay so bestie, meet git-hub β the β¨ Git command line interface to GitHub β¨ β and honestly? she ate. this is the git-hub(1) manual page and we're getting through all of it together, no skimming, no skipping, fr fr π
β¨ SYNOPSIS β¨
git hub [global options] <command> [options] [arguments]
π¦ DESCRIPTION π¦
so git hub is a simple command line interface to github, and the whole point is that most of the actually-useful GitHub tasks (like creating and listing pull requests or issues) can be hit directly through the git command line. no browser tab, no vibes-ruining clicking, just terminal. iconic. π
to use this command you'll probably need to do an initial configuration first, so you can get authorization from GitHub. for that you use the setup command. and if you want the whole menu of configuration options, go look at the CONFIGURATION section. π«Ά
π GLOBAL OPTIONS π
-h,--helpβ show this help and exit. the classic escape hatch πββοΈ--versionβ show the program's version number and exit.-v,--verboseβ be more verbose. you can pass it multiple times to get extra verbosity (she will yap, and you will listen) π£οΈ-s,--silentβ be less verbose. also stackable β pass it multiple times to get less verbosity. π€«
π COMMANDS π
π setup
this command does an initial setup so you can connect to GitHub. basically it asks for a username and a GitHub Personal Access Token (PAT), which is needed for most actions. like, most of the good stuff is locked behind that token, periodt.
the token will be stored it in the Git configuration variable hub.oauthtoken for future use. if you don't have one, you can create it (check GitHub docs if you need more help). make sure your PAT has at least repo and user scope. β οΈ
the username is also stored for future use, in the hub.username variable. and if the base URL is specified, it gets stored in hub.baseurl too.
by default the configuration is stored in the repository's .git/config file (using git config). if you want your configuration to be global to your user, or system-wide, use the --global or --system option respectively. those options get passed straight to git config. π«
-uUSERNAME,--username=USERNAME β GitHub's username (login name), which will be stored in the configuration variablehub.username. if an e-mail is provided, then a username matching that e-mail will be searched and used instead, if found (for this to work the e-mail must be part of the public profile). π-oTOKEN,--oauthtoken=TOKEN β GitHub's Personal Access Token (PAT), which will be stored in the configuration variablehub.username. if an e-mail is provided, then a username matching that e-mail will be searched and used instead, if found (for this to work the e-mail must be part of the public profile).-bURL,--baseurl=URL β GitHub's base URL to use to access the API. set this when your GitHub API lives somewhere other than the default (Enterprise servers usually usehttps://host/api/v3).--globalβ store settings in the global configuration (see the--globaloption ingit config(1)for details).--systemβ store settings in the system configuration (see the--systemoption ingit config(1)for details).
πΈ clone REPO [DEST]
this command clones REPO, a GitHub repository, into a DEST directory (which defaults to the name of the project being cloned). if the repository is specified in <owner>/<project> form, then REPO is used as upstream and a personal fork gets looked up. if none is found, a brand new fork is created. in both cases, the fork gets cloned instead of the upstream repository. and REPO can be given as a regular clone URL too (http, ssh, git) β in that case the URL gets inspected and hub.urltype is set as appropriate. π§
if only <project> is specified as REPO, then the configuration hub.username is used as <owner>, and the parent repository is looked up at GitHub to figure out the real upstream repository.
the upstream repository is cloned as --upstreamremote (or hub.upstreamremote, upstream by default), the remote for the fork is added as --forkremote (or hub.forkremote, fork by default), and the fork is set as the git remote.pushdefault (so pushing will hit the fork by default) β unless --no-triangular is used (please go read that option for the details, bestie, don't skip it π).
after cloning and fetching, the git configuration variables hub.upstream, hub.upstreamremote and hub.forkremote are set in the newly cloned repo (see CONFIGURATION).
-UNAME,--upstreamremote=NAME β use NAME as the upstream remote repository name instead of the default'upstream').-FNAME,--forkremote=NAME β use NAME as the fork remote repository name instead of the default'fork').-t,--triangularβ use Git's triangular workflow configuration (this is the default). this option clones from the parent/upstream repository, and adds the fork as a remote repository. then it sets theremote.pushdefaultGit option and thehub.forkremotegit-hub option to the just cloned repository.
the effect of this is having the upstream repository used by default when you pull, but using your fork when you push β which is typically exactly what you want when you're doing GitHub's pull requests. π
Git version 1.8.3 or newer is needed to use this option (and 1.8.4 or newer is recommended, because of some issues in 1.8.3 related to this). β οΈ
to change the default you can set the option hub.triangular. see CONFIGURATION for details.
--no-triangularβ don't use Git's triangular workflow configuration (this is only available for backwards compatibility but is not recommended). this option clones from the forked repository instead of cloning the upstream/parent repo, so both pulls and pushes will be done with the fork by default.
this option could also be used to clone a GitHub repository without forking it, but heads up: some functionality of the tool will be lost. π
π§΅ GIT CLONE OPTIONS
any standard git clone option can be passed. not all of them might make sense when you're cloning a GitHub repo to be used with this tool though.
this command will run the hub.hookscript on some events β please have a look at HOOK SCRIPT for more details. π
π issue
this command is used to manage GitHub issues through a set of subcommands. she's got range. π
π list
show a list of open issues.
-c,--closedβ show closed issues instead.-C,--created-by-meβ show only issues created by me πββοΈ-A,--assigned-to-meβ show only issues assigned to me
π show ISSUE [ISSUE ...]
show issues identified by ISSUE.
β¨ new
create a new issue.
the content of the template files ISSUE_TEMPLATE or ISSUE_TEMPLATE.md will be added to the issue message if any of those template files is found in the top-level directory of the project, the .github directory or the .git directory. the order for template file lookups matters, and it follows the order as described above for template file names and directories. and only the content of the first template found will be added. π
-mMSG,--message=MSG β issue title (and description). the first line is used as the issue title and any text after an empty line is used as the optional body. if this option is not used, the defaultGIT_EDITORis opened so you can write one. βοΈ-lLABEL,--label=LABEL β attach LABEL to the issue (can be specified multiple times to set multiple labels).-aUSER,--assign=USER β assign a user to the issue. USER must be a valid GitHub login name.-MID,--milestone=ID β assign the milestone identified by the number ID to the issue.--no-templateβ do not add the template content to the message.
π οΈ update ISSUE
similar to new but it updates an existing issue identified by ISSUE.
a convenient shortcut to close an issue is provided by the close subcommand. π
-mMSG,--message=MSG β new issue title (and description). the first line is used as the issue title and any text after an empty line is used as the optional body.-tTITLE,--title=TITLE β new issue title.-e,--edit-messageβ open the defaultGIT_EDITORto edit the current title (and description) of the issue.-o,--openβ reopen the issue.-c,--closeβ close the issue.-lLABEL,--label=LABEL β if one or more labels are specified, they will replace the current issue labels. otherwise the labels are unchanged. if one of the labels is empty, the labels will be cleared (so you can use-l''to clear the labels of an issue. π§Ό-aUSER,--assign=USER β assign a user to the issue. USER must be a valid GitHub login name.-MID,--milestone=ID β assign the milestone identified by the number ID to the issue.
π¬ comment ISSUE
add a new comment to an existing issue identified by ISSUE.
-mMSG,--message=MSG β comment to be added to the issue. if this option is not used, the defaultGIT_EDITORis opened to write the comment.
π close ISSUE
alias for update --close. (plus comment if --message or --edit-message is specified). closes the issue identified by ISSUE.
to be continued, bestie β there's more of this page and we are NOT stopping now π¦
-m MSG,--message=MSGβ drop a lil comment on the issue before you close it π¬-e,--edit-messageβ opens your defaultGIT_EDITORso you can write the comment that gets added to the issue right before closing. So polite of it.
π pull π
okay bestie, this one manages GitHub pull requests. And here's the tea: pull requests on GitHub are also issues, so most of the subcommands here are straight-up repeats from the issue command, just for convenience. The only ones that are actually different are list and new, plus attach and rebase get added to the party. π
β¨ list β¨
Show a list of open pull requests. Iconic, simple, we love her.
--closedβ show the closed pull requests instead. still valid, just retired πͺ¦
β¨ show PULL [PULL ...] β¨
Just an alias for issue show. same energy, no notes.
β¨ checkout PULL ... β¨
Checks out the remote branch (the head) of the pull request. What it does: first it fetches the head reference from the PR, then it calls the standard git checkout command. Any extra argument you pass gets handed to git checkout as-is, placed after the reference that was just fetched. π«Ά
Heads up bestie: this creates a detached checkout by default π use-bif you want to make a new branch based on the pull request. And pls go readgit checkouthelp for the full details, iykyk.
β¨ new [HEAD] β¨
Creates a brand new pull request. If you give it HEAD, that gets used as the branch (or git ref) where your changes live. If you don't, it uses the current branch. And if the branch you're using as head hasn't been pushed to your fork remote yet, it'll automatically push before creating the PR. no cap, it just does it for you β¨
The repository the pull request is issued from comes from the hub.forkrepo configuration, which defaults to hub.username/<hub.upstream project part>.
About the message: the content of the template files PULL_REQUEST_TEMPLATE or PULL_REQUEST_TEMPLATE.md gets added to the pull request message if either of those template files is found in the top-level directory of the project, the .github directory, or the .git directory. The lookup order matters, and it follows the order described above β for both the template file names and the directories. Only the content of the first template found gets added. first come, first served, periodt π
-m MSG,--message=MSGβ the pull request title (and description). The first line becomes the pull request title, and any text after an empty line becomes the optional body. If you don't use this option, the defaultGIT_EDITORopens. If the HEAD branch has a proper description (seegit branch --edit-description), that description is used as the default message in the editor β and if it doesn't, the message of the last commit is used instead. π-l LABEL,--label=LABELβ attachesLABELto the pull request (you can pass this multiple times to set multiple labels, go off π).-a USER,--assign=USERβ assigns a user to the pull request.USERmust be a valid GitHub login name.-M ID,--milestone=IDβ assigns the milestone identified by the numberIDto the pull request.-b BASE,--base=BASEβ the branch (or git ref) you want your changes pulled into. By default the tracking branch (thebranch.<ref>.mergeconfiguration variable) is used, or the configurationhub.pullbaseif you're not tracking a remote branch. If none of those is present, an error gets displayed. π-c NAME,--create-branch=NAMEβ creates a new remote branch (with the nameNAME) as the real head for the pull request, instead of using the HEAD name passed asHEAD. Super useful when you wanna make a PR for a hot-fix you committed to your regular HEAD without making a branch first. π§-f,--force-pushβ forces the push operations. Use with care! π¨-d,--draftβ creates a draft pull request. Draft pull requests can't be merged, and code owners are not automatically requested to review draft pull requests.
β¨ attach ISSUE [HEAD] β¨
Converts the issue identified by ISSUE into a pull request by attaching commits to it. You can optionally specify the branch (or git ref) where your changes are implemented with HEAD β otherwise the current branch is used. This subcommand is very similar to the new subcommand, so go peek at that one for more details.
Please note: you can only attach commits to issues if you have commit access to the repository, or if you're assigned to the issue. no shortcuts bestie π
-m MSG,--message=MSGβ adds a comment to the issue/new pull request.-e,--edit-messageβ opens the defaultGIT_EDITORto write a comment to be added to the issue/new pull request. The default message is taken from the--messageoption if present; otherwise the branch description or the first commit message is used, just like with thenewsubcommand.-b BASE,--base=BASEβ same aspull new, please see the details there. π«‘-c NAME,--create-branch=NAMEβ creates a new remote branch (with the nameNAME) as the real head for the pull request, instead of using the HEAD name passed asHEAD. Great for making a pull request for a hot-fix you committed to your regular HEAD without creating a branch first.-f,--force-pushβ forces the push operations. Use with care! π¨
β¨ rebase PULL β¨
Closes a pull request identified by PULL by rebasing its base branch (the one specified in the pull request) instead of merging like GitHub's Merge Buttonβ’ would do. we're doing it the pretty way β¨
If the operation succeeds, a comment gets posted telling everyone the new HEAD commit of the branch that got rebased, and the pull request gets closed.
The type of URL used to fetch and push can be specified through the hub.pullurltype configuration variable (see CONFIGURATION for more details). Ideally your working copy stays exactly the same β if everything went OK, it does.
The operations this subcommand performs are roughly these:
git stashgit fetch pullheadgit checkout -b tmp FETCH_HEADgit pull --rebase pullbasegit push pullbasegit checkout oldheadgit branch -D tmpgit stash pop
If hub.forcerebase is set to "true" (which is the default), --force gets passed to rebase β and no, don't confuse that with this command's own option --force-push, which forces the push. Otherwise (if it's "false") a regular rebase is performed. When the rebase is forced, all the commits in the pull request are re-committed, so the Committer and CommitterDate metadata gets updated in the commits β showing the person who performed the rebase and the time of the rebase instead of the original values, which is honestly more useful info. Side effect bestie: the hashes of the commits will change. π
If conflicts are found, the command gets interrupted, just like how git rebase would do it. You should either --abort the rebasing, --skip the conflicting commit, or resolve the conflict and --continue. When you use one of these actions, you have to omit the PULL argument.
-m MSG,--message=MSGβ use this message for the comment instead of the default. Specify an empty message (-m'') to completely omit the comment. β¨-e,--edit-messageβ opens the defaultGIT_EDITORto write the comment.--force-pushβ forces the push operations. Use with care! π¨-p,--pauseβ pauses the rebase right before the results get pushed and the issue gets merged. To resume the pull request rebasing (push the changes upstream and close the issue), just use the--continueaction. This is especially useful for testing. π§ͺ-u,--stash-include-untrackedβ passes the--include-untrackedoption to stash. If used, all untracked files are also stashed and then cleaned up withgit clean, leaving the working directory in a very clean state β which avoids conflicts when checking out the pull request to rebase. immaculate vibes π§Ό-a,--stash-allβ passes the--alloption to stash. It's like--stash-include-untracked, but the ignored files get stashed and cleaned in addition to the untracked files, which completely removes the possibility of conflicts when checking out the pull request to rebase. maximum cleanliness, zero chaos π«§-D,--delete-branchβ deletes the pull request branch if the rebase was successful. This is similar to pressing the "Delete Branch" Button (TM) in the web interface after merging. ποΈ
Actions:
--continueβ Continue an ongoing rebase. slay, keep going π--abortβ Abort an ongoing rebase. not the vibe, but okay π--skipβ Skip current patch in an ongoing rebase and continue. keep it moving bestie πββοΈupdate PULLβ Alias forissue update. β¨comment PULLβ Alias forissue comment. π¬close PULLβ Alias forissue close. π
πͺ HOOK SCRIPT πͺ
If the git configuration hub.hookscript is present, it will be used as a (shell) script to execute on certain events. Some data is passed as environment variables to the script. All events will set the HUB_HOOK environment variable with the name of the hook being executed. periodt.
NOTE: This is an experimental feature, so it is only enabled for one event only so far. π
Available hooks (events):
postclone
Executed after a clone command was done successfully. The script will be run with the freshly cloned repository directory as the current working directory, so the git configuration just done by the clone command is available (for example, git config hub.forkremote will get the fork remote). so handy bestie π«Ά
The following extra environment variables are defined:
HUB_TRIANGULARβ will be set totrueif the clone was done in triangular mode and tofalseotherwise. boolean queenHUB_FETCHREMOTEβ will be set tohub.forkremoteif triangular was used and tohub.upstreamremoteotherwise. remote vibes
This hook is useful to set some extra git configuration that should be enabled only when cloning a repository via this tool. For example, to prune the fork remote when it is updated, but only when triangular was used in the clone you can use:
git config --global hub.hookscript 'if test "$HUB_HOOK" = postclone && $HUB_TRIANGULAR ; then git config remote.fork.prune true; fi'
βοΈ CONFIGURATION βοΈ
This program use the git configuration facilities to get its configuration from. the way it just reads your git config These are the git config keys used:
hub.usernameβ Your GitHub username. [default: current OS username] hey bestiehub.oauthtokenβ required This is the authorization token obtained via thesetupcommand. Even when required, you shouldn't need to set this variable manually. Use thesetupcommand instead. trust the process
If you don't want to store the token in plain text, you can also specify a command by prefixing a !. The output of that command will be used as the token. The command will be run with the default shell.
For example: oauthtoken = !password-manager ~/my.db get github-oauth-token.
hub.upstreamβ required Blessed repository used to get the issues from and make the pull requests to. The format is<owner>/<project>. This option can be automatically set by theclonecommand and is not really required by it or thesetupcommand. auto-magichub.upstreamremoteβ Remote name for accessing the upstream repository [default:upstream]. up up and awayhub.forkrepoβ Your blessed repository fork. The format is<owner>/<project>. Used to set the head for your pull requests. [default:<username>/(upstream <project> part)]. fork ithub.forkremoteβ Remote name for accessing your fork. Used to push branches before creating a pull request. [default:fork]. push pushhub.pullbaseβ Default remote branch (or git reference) you want your changes pulled into when creating a pull request. [default:master]. the base of it allhub.urltypeβ Type of URL to use when an URL from a GitHub API is needed (for example, whenpull rebaseis used). At the time of writing it could bessh_urlorclone_urlfor HTTP). See GitHub's API documentation[1] for more details or options. [default:ssh_url]. url vibeshub.baseurlβ GitHub's base URL to use to access the API. Set this when your GitHub API is in another location other than the default (Enterprise servers usually usehttps://host/api/v3). This will be prepended to all GitHub API calls and it has to be a full URL, not just something like"www.example.com/api/v3/". full URL only bestiehub.forcerebaseβ If is set to"true",--forcewill be passed torebase. If is set to"false"a regular rebase is performed. See thepull rebasecommand for details. [default:true]. force ithub.triangularβ Makes--triangularforcloneif set to"true"(boolean value). Seeclonedocumentation for details. triangular slayhub.hookscriptβ Script to run on certain events. Please have a look at HOOK SCRIPT for more details. hooks hooks hooks
[1] https://developer.github.com/v3/pulls/#get-a-single-pull-request
π FILES π
This program creates some temporary files in the .git directory during its operation. The contents of these files can be used for debugging/recovery purposes if necessary. save the receipts π§Ύ
HUB_EDITMSGβ This file is used to take input from the user, e.g. issue comments, pull request title & description etc. If, after accepting user input, the command given by the user fails for some reason, then the entered text can still be retrieved from this file. your words are safeHUB_PULL_REBASINGβ This file is used to store various metadata information related to a rebase operation (with the primary aim of being able to rollback the repository to its original state if the rebase fails or is interrupted due to conflicts). The sole presence of this file indicates that a rebase is in progress. rebase in progress, do not disturb π€
π VIM SYNTAX HIGHLIGHT π
A VIM ftdetect plugin is provided, to enable it you have to follow some steps though. All you need to do is copy (or preferably make a symbolic link) the script to ~/.vim/ftdetect/githubmsg.vim:
mkdir -p ~/.vim/ftdetect
ln -s /usr/share/vim/addons/ftdetect/githubmsg.vim ~/.vim/ftdetect/
# or if you are copying from the sources:
# ln -s ftdetect.vim ~/.vim/ftdetect/githubmsg.vim
vim girlies rise π
π AUTHOR π
Leandro Lucarella <leandro.lucarella@dunnhumby.com> the icon, the legend π«Ά
Β©οΈ COPYRIGHT Β©οΈ
2013 dunnhumby Germany GmbH periodt π
and that's the tea bestie β β this page is from the devel source/version, dated 2022-01-31, and it's the GIT-HUB(1) manual. now go slay some git π
β¨
π¦ where this page comes from
- ubuntu jammy: git-hub 2.1.3-1 Β· GPL-3.0-or-later
- ubuntu noble: git-hub 2.1.3-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms