在git开发中,难免会因为分支过多难以管理。所以注释是有必要的;
在安装之前先要安装npm;
sudo apt install npm
可能会遇到问题:
Readingpackagelists... Done
Building dependency tree
Reading state information... Done
Somepackages couldnotbe installed. This may mean that you have
requested an impossible situationorifyouareusingthe unstable
distribution thatsomerequiredpackages havenotyet been created
orbeen movedoutofIncoming.
Thefollowinginformation mayhelptoresolve the situation:
Thefollowingpackages have unmet dependencies:
npm : Depends: nodejs but itisnotgoingtobe installed
Depends: node-abbrev (>=1.0.4) but itisnotgoingtobe installed
Depends: node-ansi (>=0.3.0-2) but itisnotgoingtobe installed
Depends: node-ansi-color-tablebut itisnotgoingtobe installed
Depends: node-archy but itisnotgoingtobe installed
Depends: node-block-stream but itisnotgoingtobe installed
Depends: node-fstream (>=0.1.22) but itisnotgoingtobe installed
Depends: node-fstream-ignorebut itisnotgoingtobe installed
Depends: node-github-url-from-git but itisnotgoingtobe installed
Depends: node-glob (>=3.1.21) but itisnotgoingtobe installed
Depends: node-graceful-fs (>=2.0.0) but itisnotgoingtobe installed
Depends: node-inherits but itisnotgoingtobe installed
Depends: node-ini (>=1.1.0) but itisnotgoingtobe installed
Depends: node-lockfile but itisnotgoingtobe installed
Depends: node-lru-cache(>=2.3.0) but itisnotgoingtobe installed
Depends: node-minimatch (>=0.2.11) but itisnotgoingtobe installed
Depends: node-mkdirp (>=0.3.3) but itisnotgoingtobe installed
Depends: node-gyp (>=0.10.9) but itisnotgoingtobe installed
Depends: node-nopt (>=3.0.1) but itisnotgoingtobe installed
Depends: node-npmlog but itisnotgoingtobe installed
Depends: node-once but itisnotgoingtobe installed
Depends: node-osenv but itisnotgoingtobe installed
Depends: node-readbut itisnotgoingtobe installed
Depends: node-read-package-json(>=1.1.0) but itisnotgoingtobe installed
Depends: node-request (>=2.25.0) but itisnotgoingtobe installed
Depends: node-retry but itisnotgoingtobe installed
Depends: node-rimraf (>=2.2.2) but itisnotgoingtobe installed
Depends: node-semver (>=2.1.0) but itisnotgoingtobe installed
Depends: node-shabut itisnotgoingtobe installed
Depends: node-slide but itisnotgoingtobe installed
Depends: node-tar (>=0.1.18) but itisnotgoingtobe installed
Depends: node-underscore but itisnotgoingtobe installed
Depends: node-which but itisnotgoingtobe installed
解决:
sudo apt-get install aptitude
sudo aptitude install npm
出现:Accept this solution? [Y/n/q/?] 请选择Y
The following NEW packages will be installed:
gyp{a}javascript-common{a}libjs-async{a}libjs-inherits{a}libjs-jquery{a}libjs-node-uuid{a}
libjs-underscore{a}node-abbrev{a}node-ansi{a}node-ansi-color-table{a}node-archy{a}node-async{a}
node-balanced-match{a}node-block-stream{a}node-brace-expansion{a}node-builtin-modules{a}
node-combined-stream{a}node-concat-map{a}node-cookie-jar{a}node-delayed-stream{a}node-forever-agent{a}
node-form-data{a}node-fs.realpath{a}node-fstream{a}node-fstream-ignore{a}node-github-url-from-git{a}
node-glob{a}node-graceful-fs{a}node-gyp{a}node-hosted-git-info{a}node-inflight{a}node-inherits{a}
node-ini{a}node-is-builtin-module{a}node-isexe{a}node-json-stringify-safe{a}node-lockfile{a}
node-lru-cache{a}node-mime{a}node-minimatch{a}node-mkdirp{a}node-mute-stream{a}node-node-uuid{a}
node-nopt{a}node-normalize-package-data{a}node-npmlog{a}node-once{a}node-osenv{a}node-path-is-absolute{a}
node-pseudomap{a}node-qs{a}node-read{a}node-read-package-json{a}node-request{a}node-retry{a}node-rimraf{a}
node-semver{a}node-sha{a}node-slide{a}node-spdx-correct{a}node-spdx-expression-parse{a}
node-spdx-license-ids{a}node-tar{a}node-tunnel-agent{a}node-underscore{a}node-validate-npm-package-license{a}
node-which{a}node-wrappy{a}node-yallist{a}npm
0packages upgraded,70newly installed,0toremoveand335notupgraded.
Needtoget2536kBofarchives. After unpacking15.2MB will be used.
The following packages have unmet dependencies:
nodejs : Conflicts: npm but3.5.2-0ubuntu4istobe installed
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) npm [NotInstalled]
Accept this solution? [Y/n/q/?] Y
No packages will be installed, upgraded,orremoved.
0packages upgraded,0newly installed,0toremoveand335notupgraded.
Needtoget0Bofarchives. After unpacking0B will be used.
npm -v 查看版本,可以看到npm已经安装完毕;
注意!!!:如果出现:说明你没有切换到root用户权限;
最后执行npm i -g git-br
安装git分支注释成功;
正常可以这样添加注释:
git config branch.分支名.description '这里添加注释'
然后获取分支注释;
git config branch.分支名.description
现在添加注释不变,但是可以 git br 命令获取分支和注释;
友情提示:
在安装之后可能会出现没有tab自动补全了,这个问题没有细去研究,过一会自动好了;
不过可以这么做:
1.下载配置文件 git clone git://git.kernel.org/pub/scm/git/git.git
2.cp git/contrib/completion/git-completion.bash ~/.git-completion.bash
3.在.bashrc中添加 source ~/.git-completion.bash
4.source ~/.bashrc
这样可以解决没有自动补全的问题;