git hub is a simple command line interface to GitHub, enabling most usefulGitHub tasks (like creating and listing pull request or issues) to be accesseddirectly through the Git command line.
Although probably the most outstanding feature (and the one that motivated thecreation of this tool) is the pull rebase
command, which is the rebasingversion of the GitHub Merge (TM) button. This enables an easy workflow thatdoesn't involve thousands of merges which makes the repository historyunreadable.
Another unique feature is the ability to transform an issue into a pullrequest by attaching commits to it (this is something offered by the GitHubAPI but not by the web interface).
Here are some usage examples, for more information about all the supportedcommand an options, please refer to the man page using git hub --help
orlooking at the online version (this is for the latest development snapshotthough).
To use this tool you most likely will need a GitHub PAT (personal access token).If you don't have one you regularly use, you can create a new one (checkGitHub docs if you need more help).
Make sure your PAT has at least repo and user scope.
Then you can use git hub setup
to save it.
$ git hub setup --global --user octocat You need to use a GitHub Personal Access Token to do almost anything useful. To create one you can go to: https://github.com/settings/tokens/new. More help at: https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token. GitHub token: ****** Saved git config hub.username Saved git config hub.oauthtoken
You can revoke this credentials at any time in the GitHub Applications Settingspage.
$ git hub clone -t sociomantic-tsunami/git-hub Forking sociomantic-tsunami/git-hub to octocat/git-hub Cloning git@github.com:sociomantic-tsunami/git-hub.git to git-hub Fetching from fork (git@github.com:octocat/git-hub.git)
The fork will happen only if you haven't fork the project before, of course. Andwe are using the triangular workflow option (-t
/ --triangular
), so wecan pull from the parent repo but push to our fork by default.
$ git config hub.upstream sociomantic-tsunami/git-hub
This sets the master GitHub project. It's where we query for issues and pullrequests and where we create new pull requests, etc.
This is only necessary if you didn't clone your repository using git hubclone
and is a one time only setup step.
$ git hub issue list [3] pull: Use the tracking branch as default base branch (leandro-lucarella-sociomantic) https://github.com/sociomantic-tsunami/git-hub/issues/3 [1] bash-completion: Complete with IDs only when is appropriate according to command line arguments (leandro-lucarella-sociomantic) https://github.com/sociomantic-tsunami/git-hub/issues/1
$ git hub issue update --label important --label question \ -m 'New Title' --assign octocat --open --milestone v0.5 1 [1] New Title (leandro-lucarella-sociomantic) https://github.com/sociomantic-tsunami/git-hub/issues/1
$ git hub pull new -b experimental -c mypull Pushing master to mypull in myfork [4] Some pull request (octocat) https://github.com/sociomantic-tsunami/git-hub/pull/4
This creates a pull request against the upstream branch experimental
usingthe current HEAD
, but creating a new topic branch called mypull
to storethe actual pull request (assuming our HEAD
is in the branch master
).
$ git hub pull attach -b experimental -c mypull 1 Pushing master to mypull in myfork [1] Some issue (octocat) https://github.com/sociomantic-tsunami/git-hub/pull/1
Same as before, but this time attach the commits to issue 2 (effectivelyconverting the issue into a pull request).
$ git hub pull rebase 4 Fetching mypull from git@github.com:octocat/git-hub.git Rebasing to master in git@github.com:sociomantic-tsunami/git-hub.git Pushing results to master in git@github.com:sociomantic-tsunami/git-hub.git [4] Some pull request (octocat) https://github.com/sociomantic-tsunami/git-hub/pull/4
If the rebase fails, you can use git hub pull rebase --continue
as you woulddo with a normal rebase.
You can get this tool from the GitHub project. If you want to graba release, please remember to visit the Release section.
Only the man page and bash completion script need to be built. Type make
to build them.
Alternatively, you can build a Debian/Ubuntu package. Use make deb
forthat.
If you built the Debian/Ubuntu package, you can just install the package(dpkg -i ../git-hub_VER_all.deb
).
Otherwise you can type make install
to install the tool, man page, bashcompletion and VIM ftdetect plugin (by default in /usr/local
, but youcan pick a different location by passing the prefix
variable to make
(for example make install prefix=/usr
). To pick a location for thecompletion scripts (by default in /etc
), use the sysconfdir
variable.
If Docutils is installed using pip
the environment variable RST2MAN
should be set to rst2man.py
.
The installation locations might be too specific for Debian/Ubuntu though.Please report any failed installation attempts.
To enjoy the bash completion you need to re-login (or re-load the/etc/bash_completion
script).
To have syntax highlight in VIM when editing git-hub messages, you need toactivate the ftdetect plugin by copying or symbolic-linking it to~/.vim/ftdetect/githubmsg.vim
:
mkdir -p ~/.vim/ftdetect ln -s $(prefix)/share/vim/addons/githubmsg.vim ~/.vim/ftdetect/ # or if you are copying from the sources: # ln -s ftdetect.vim ~/.vim/ftdetect/githubmsg.vim
We explored other alternatives before starting this project, but none ofthese tools do (or are targeted) at what we needed. But here are the ones wefound, in case they are a better fit for you:
hub
command, which can introduce a lot of confusion to users.We might try to merge our code into that project eventually, if there isinterest.If you want to contact us, either because you are a user and have questions, orbecause you want to contribute to the project, you can subscribe to the mailinglist.
Subscription happens automatically (after confirmation) the first time you writeto: git.hub@librelist.com (this first e-mail will be dropped).
You can always visit the mailing list archives to check if your questionswere already answered in the past :)
You can also use GMANE to get a better list archive (both threaded andblog-like interfaces available) or to read the list using NNTP.
If you want to report a bug, just create an issue please (if you use thistool I'm sure you already have a GitHub account ;).
参考: 将派生出的副本克隆到本地 创建出名称有意义的分支 修改代码 检查改动 将改动提交到分支中 将新分支推送到 GitHub 的副本中 git clone https://github.com/tonychacon/blink cd blink git checkout -b slow-blink git diff --word-diff git commit -a -m 'three seco
n Linux下git-hub常用操作 一、Git本地命令 创建一个文件夹,后面将以该文件夹作为git本地仓库 mkdir gittest 拉代码 git clone https://github用户名@github.com/github用户名/gittest.git 初始化git仓库 git init 申请邮箱 #设置仓库所有者的邮箱 git config --global u
注册码云 安装git hub git init here 创建本地仓库(repository),将会在文件夹下创建一个 .git 文件夹,.git 文件夹里存储了所有的版本信息、标记等内容 git add 从本地仓库增删,结果将会保存到本机的缓存里面 git rm git commit -m "注释" 提交,把本机缓存中的内容提交到本机的 HE
首先需要在本地的bash下配置个人信息和ssh-keygen以与github服务器保持一致 在cmd或者终端下输入以下命令行: git config --global user.name trigkit4(github用户名) git config --global user.email 345823102@qq.com(绑定的邮箱) 创建本地ssh 在终端或cmd输入以下命令行: ssh-key
在文件夹中新建项目: mkdir person cd person mkdir xx git init touch app.py # 创建了一个新的文件 git status # 文件状态 git add . git commit -m "xxx" # 版本信息 git status # 检查状态 在git_hub中新建一个组织,上传信息: git remote add origin
创建一个新文件 ~/.gitignore ,并将以下内容添加进去,这样全部 git 仓库将会忽略以下内容所提及的文件。 # Folder view configuration files .DS_Store Desktop.ini # Thumbnail cache files ._* Thumbs.db # Files that might appear on external disks .S
功能分支(feature branches)、发布分支(release branches)、主干(master)、开发分支(develop)、紧急修复分支(hotfixes)和标签(tag)。 Git Flow 太复杂 Git Flow 违背了分支的“短命”原则:在使用 Git 时,在同一个分支上开发代码的人越多,出现合并冲突的几率就越高。在使用 Git Flow 后,冲突几率会变得更高,因为还有
规范建设 commit message格式 <type>(<scope>): <subject> type(必须) 用于说明git commit的类别,只允许使用下面的标识。 feat:新功能(feature)。 fix/to:修复bug,可以是QA发现的BUG,也可以是研发自己发现的BUG。 fix:产生diff并自动修复此问题。适合于一次提交直接修复问题 to:只产生diff不自动修复此问题
集中式与分布式 中心服务器 工作流 分支实现 冲突 Fast forward 储藏(Stashing) SSH 传输设置 .gitignore 文件 Git 命令一览 参考资料 集中式与分布式 Git 属于分布式版本控制系统,而 SVN 属于集中式。 集中式版本控制只有中心服务器拥有一份代码,而分布式版本控制每个人的电脑上就有一份完整的代码。 集中式版本控制有安全性问题,当中心服务器挂了所有人都没
作为一名开发者怎么可能没有 Git 呢? 我们马上就来安装: $ brew install git 好的,现在我们来测试一下 git 是否安装完好: $ git --version 运行 $ which git 将会输出 /usr/local/bin/git. 接着,我们将定义你的 Git 帐号(与你在 GitHub 使用的用户名和邮箱一致) $ git config --global user.
Name git - 迟钝的内容跟踪器 概要 git [--version] [--help] [-C <path>] [-c <name>=<value>] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects]
Overview 始终没有很好的掌握Git, 这又是Stage又是Stack的,每次冲突都要找同事来帮忙解决。 Tools 貌似SmartGit最美观最好用,但License始终是个问题,只有非商业软件才能免费用。 SourceTree最大问题是不能按目录来查看文件和Log。 Commands remove tag remotelly git tag -d V4.0.0.GA git push o
Git 可以为项目做版本控制项目。 先搜索一下: yum search git 我看到一些 git2u 这个前缀的包,这应该是 ius 仓库提供的。 安装 Git: sudo yum install git2u -y 如果出现冲突的提示,是因为你的系统里已经包含了 Git,需要先删除掉系统里的 Git 才能继续安装。 再做一点简单的配置,告诉 Git 我们是谁: git config --g