git不需要提交的的脚本_我不能没有的4个Git脚本

git不需要提交的的脚本

2005年, Linus Torvalds创建了Git来取代他以前用来维护Linux内核的专有分布式源代码管理管理解决方案。 从那时起,Git已成为开源和云原生开发团队的主要版本控制解决方案。

TJ Holowaychuk 。 他的Git Extras项目托管了60多个“扩展”,这些功能扩展了Git的基本功能。

使用Git Extras

这是使用四个最受欢迎的Git Extras的方法。

git-ignore

git-ignore是一个方便的附加功能,它允许您手动将文件类型和注释添加到.git-ignore文件,而无需打开文本编辑器。 它与用户帐户的全局忽略文件以及您正在使用的存储库的单个忽略文件一起使用。

不带参数执行git-ignore将首先列出全局忽略文件,然后列出本地忽略文件。


   
   
$ git ignore
Global gitignore: / home / alice / .gitignore
# Numerous always-ignore extensions
* .diff
* .err
* .orig
* .rej
* .swo
* .swp
* .vi
* ~
* .sass-cache

# OS or Editor folders
Thumbs.db
---------------------------------
Local gitignore: .gitignore
nbproject

git-info

git-info会在您正在使用的存储库的上下文中检索您需要掌握的所有信息。 它包括所有远程URL,远程分支,本地分支,配置信息和最后一次提交。


   
   
$ git info

## Remote URLs:

origin       git @ github.com:sampleAuthor / git-extras.git ( fetch )
origin       git @ github.com:sampleAuthor / git-extras.git ( push )

## Remote Branches:

origin / HEAD - > origin / master
origin / myBranch

## Local Branches:

myBranch
* master

## Most Recent Commit:

commit e3952df2c172c6f3eb533d8d0b1a6c77250769a7
Author: Sample Author < sampleAuthor @ gmail.com >

Added git-info command.

Type ´ git log ´ for more commits, or ´ git show < commit id > ´ for full commit details.

## Configuration (.git/config):

color.diff=auto
color.status=auto
color.branch=auto
user.name=Sample Author
user.email=sampleAuthor @ gmail.com
core.repositoryformatversion= 0
core.filemode= true
core.bare= false
core.logallrefupdates= true
core.ignorecase= true
remote.origin.fetch=+refs / heads /* :refs / remotes / origin /*
remote.origin.url= git @ github.com:mub / git-extras.git
branch.master.remote=origin
branch.master.merge=refs / heads / master

git-mr和git-pr

这些额外功能会做类似的事情,并且基本上以相同的方式工作。

  • git-mr从GitLab检出合并请求
  • git-pr在GitHub上检查拉取请求

无论哪种情况,您都只需要合并或请求请求号或完整的URL,它将获取远程引用,检出分支并调整配置,因此Git知道它将替换哪个分支。


   
   
$ git mr 51
From gitlab.com:owner / repository
  * [ new ref ]         refs / merge-requests / 51 / head - > mr / 51
Switched to branch 'mr/51'

git发布

通过将committagpush组合到一个命令中,git-release可以节省很多击键来执行三个经常按顺序运行的命令。

要提交特定的<tagname>和自定义消息,请执行以下操作:

 $  git release 0.1.0 -m < + powerful feature added > 

其他附加

这些只是回购中60多个Git Extras中的四个。 要访问Git Extras中可用命令的完整列表,请在源存储库中查看Commands.md文件,或在安装Git Extras之后运行以下命令。

 $  git extras --help 

安装Git Extras

Git Extras的主要前提条件是必须安装命令行版本的Git。 如果您打算从源代码构建,则还需要其他实用程序(例如, make )可用。

如果您使用的是最新版本的macOS,则最好使用Homebrew (与大多数开源工具一样)进行Git Extras安装:

 $  brew install git-extras 

在Linux上,每个平台的本机软件包管理器都提供Git Extras。 有时,您需要启用一个额外的存储库,例如CentOS上的EPEL ,然后运行一个命令:

 $  sudo yum install git-extras 

存储库中的Installation.md文件中提供了其他Linux发行版,BSD和其他平台的完整安装说明。

贡献

您是否认为Git缺少一些功能,是否已经构建或想要构建脚本来处理它? 为什么不通过使其成为Git Extras发行版的一部分与世界分享呢!

为此,请将功能贡献给Git Extras存储库。 存储库中的CONTRIBUTING.md文件中有更多具体细节,但是基础很简单:

  1. 创建一个处理该功能的Bash脚本。
  2. 创建一个基本的man文件,以便人们知道如何使用它。
  3. 更新命令列表和完成脚本,以使人们知道该功能的存在。
  4. 运行完整性检查以确保您没有破坏任何东西。
  5. 为您的功能创建一个拉取请求。

为Git Extras做出贡献将使您的Git同行用户的生活变得更加轻松。 您可以在项目的README中了解有关它的更多信息。

翻译自: https://opensource.com/article/20/4/git-extras

git不需要提交的的脚本

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Git指令的Shell脚本,能够快速便捷地管理Git库,包括添加修改、提交修改、显示库状态、推送到远程库、从远程库更新到本地、版本恢复等操作。 使用方法: 1. 在Linux系统中,将本文件放在Git库目录下,利用Shell运行本文件; 2.在windows系统中,需下载安装与操作系统相对应的Git软件,并将本文件放在Git库目录下,双击即可运行。 运行示例: Please choose the first letter of options. [Add|Commit|Diff|Fetch|Exit|Help|Log|Push|User|Reset|Status]? h A: Add all changes to repository. C: Commit all changes to repository. D: Show differences between current version with HEAD->. E: Exit shell script. F: Fetch origin/master and merge. L: Show latest two-weeks logs of repository. P: Push commissions to origin/master. U: User command mode(Press ‘Enter’ to exit). R: Reset current version according version_id. S: Show status of repository. Please choose the first letter of options. [Add|Commit|Diff|Fetch|Exit|Help|Log|Push|User|Reset|Status]? s On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: Git.sh modified: PyNote/PyNote_2.md no changes added to commit (use "git add" and/or "git commit -a") Please choose the first letter of options. [Add|Commit|Diff|Fetch|Exit|Help|Log|Push|User|Reset|Status]? a On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD ..." to unstage) modified: Git.sh modified: PyNote/PyNote_2.md
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值