cmder git bash 使用

《cmder git bash 使用》

cmder 是一款 windows 下的命令集合软件,它可以集合各种系统下的命令,并且操作非常快速方便。

安装有两个版本,一个是简化版(4.27M),一个是完全版(75.7M),它们的唯一区别:完全版包含 git-for-windows,如果你已经装了 git-for-windows,直接下载简化版就好。

cmder 没有安装文件,直接下载解压文件,运行 Cmder.exe。

如果我们想 win+r “运行”中输入 cmder 来启动,需要在系统环境变量中添加路径,如下:

《cmder git bash 使用》

添加到右键命令(需要运行管理员权限):

Cmder.exe /REGISTER ALL

以管理员权限运行命令:

《cmder git bash 使用》

下面在 cmder 中配置 git bash,win+alt+t 打开配置页面:

《cmder git bash 使用》

附 linux 常用命令:

  • mkdir:创建文件夹
  • rmdir:删除文件夹
  • ls:查看文件列表
  • cat:查看文件内容
  • echo "hello" >> file.txt:回显 和 管道命令

附 git bash 常用命令

  • ssh-keygen -t rsa -C "xishuai@cnblogs.com":生成ssh-key
  • git config --global user.name xishuai:设置用户名
  • git config --global user.email xishuai@cnblogs.com:设置用户邮箱
  • git log:查看提交历史(q 退出)
  • git log master ^origin/master:查看未传送提交的详细信息
  • git status:查看本地修改与服务器的差异。
  • git diff:比较工作目录与暂存区的差异
  • git diff HEAD:比较工作目录与仓库中最近一次的提交间的差异
  • git diff --cached:比较了暂存区与仓库中最近一次的提交间的差异。
  • git add .:将这些差异文件添加,这样就可以提交了。
  • git commit –m “这里是注释”:提交更改到服务器。
  • git commit -a -m '这里是注释':提交所有更改到服务器。
  • git pull:将服务器最新的更改获取到本地。
  • git push origin master:正式提交到远程的master服务器上。
  • git checkout master:切换到master分支。
  • git checkout -f:还原本地没有提交的修改
  • git merge local master:将本地的local合并到远程的master上。

设置提交者的昵称和邮箱:

// 设置全局
git config --global user.name "Author Name"
git config --global user.email "Author Email"
 
// 或者设置本地项目库配置
git config user.name "Author Name"
git config user.email "Author Email"

Mac 生成 SSH(将id_rsa.pub内容拷贝到 Gitlab SSH key):

$ ssh-keygen -t rsa -C yuezhongxin@gmail.com
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/xishuai/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/xishuai/.ssh/id_rsa.
Your public key has been saved in /Users/xishuai/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:V5ojvhKEAge9Mnu6OKzDT/63nVmenVPwlOVY9djrtfA yuezhongxin@gmail.com
The key's randomart image is:
+---[RSA 2048]----+
|.o              o|
|. o            o+|
| o . .      . .+=|
|o o . .    + ..oo|
| + . .  S =  .+..|
|. .   .. o .  +oo|
|oo .   ..  .  .E |
|=oo   ....= o..  |
|=+.o...oo+ o o.  |
+----[SHA256]-----+

参考资料:

    原文作者:田园里的蟋蟀
    原文地址: https://www.cnblogs.com/xishuai/p/cmder-git-bash.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞