1 Star 0 Fork 0

yhualin / git-quick

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Git命令快速使用

git命令使用。

查看配置

git config -l 列出所有配置。

全局配置

全局使用的名字和邮箱。

git config --global user.name "YourName"

git config --global user.email "YourE-Mail"

创建密钥

ll ~/.ssh 查看是否有ssh密钥。

ssh-keygen -t rsa 生成默认rsa密钥。

ssh -T git@gitee.com 密钥添加到云端后,测试秘钥。

创建仓库

空目录或非空目录上初始化创建仓库。

git init 初始化创建仓库。

克隆仓库

克隆方式创建仓库。

git clone <仓库地址> 克隆仓库。

git clone <仓库地址> <新目录名> 克隆仓库并设置新目录名。

当前仓库配置

只当前仓库使用的名字和邮箱,会覆盖全局的配置。

git config user.name "YourName"

git config user.email "YourE-Mail"

工作区状态

git status 查看工作区改动详细状态。

git status -s 查看工作区改动简要状态。

添加暂存

git add file1 file2 暂存指定的文件。

git add . 暂存所有的改动,包括新增、删除、修改、移动。

git add -A 暂存所有的改动,包括新增、删除、修改、移动。

git add -u 暂存修改,不包括新增。

提交版本

git commit -m '提交描述' 对暂存提交版本到本地仓库。

git commit -am '提交描述' 暂存改动并提交版本,对未跟踪的新增无效。

提交日志

git log 查看详细提交日志。

git log -p 查看详细提交差异日志。

git log --pretty=oneline 一行显示提交日志。

添加远程仓库地址

git remote -v 查看远程仓库地址。

git remote add origin <远程仓库地址> 添加远程仓库地址。

git remote rm origin 删除远程仓库地址。

推送到远程仓库

git push origin master 推送master分支到远程仓库。

git push -u origin master 推送到远程仓库并跟踪分支。

git push 跟踪的分支,可以简化推送命令。

拉取远程仓库

这个拉取命令,动作是只拉取,不会合并。

git fetch origin master 拉取远程仓库分支的变化。

git fetch 跟踪的分支,可以简化拉取命令。

拉取合并远程仓库

这个拉取命令,动作是拉取和合并。

git pull origin master 拉取远程仓库分支的变化合并到本地。

git pull 跟踪的分支,可以简化拉取命令。

MIT License Copyright (c) 2022 meiyh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Git快速命令 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/aervin/git-quick.git
git@gitee.com:aervin/git-quick.git
aervin
git-quick
git-quick
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891