美文网首页
GIT 笔记

GIT 笔记

作者: 不知道的是 | 来源:发表于2018-06-16 08:33 被阅读0次

CentOS 安装 GIT

sudo yum install git

root 权限
yum install git

https://www.cnblogs.com/penghongwei/p/4056216.html
https://git-scm.com/download/linux

版本回滚

git reset --hard 69f04a6a3f28da24884040ab175785056a6b614f

https://git-scm.com/docs/git-reset

本地仓库关联远程仓库

git remote add origin 仓库地址

推送指定本地分支到远程,如果远程分支不存在则新建

git push 仓库地址 example_local_branch:example_remote_branch

更新后的版本推送到远程仓库

git push 仓库地址 分支名称

获取最新版本远程仓库

git pull 仓库地址 分支名称

创建新分支

git branch 分支名

创建并切换分支

git checkout -b 分支名

切换分支

git checkout 分支名

注意:

(1)

git commit -m 'Improve app's performance' // Wrong

Use the double quote instead of single quote

git commit -m "Improve app's performance" // Right

(2) 使用 git checkout -b 分支名 命令

创建并直接切换到新的分支去之前,一定要先确认当前分支是否还有更改的内容未提交 @.@

如果执行 命令 前,不进行提交的话,分支的版本将保留在上一次提交时。

git ignore

node_modules/
config/

等价于

/node_modules/
/config/

**只会忽略根目录起第一层的目录**
git-ignore-1346.gif

https://www.cnblogs.com/kevingrace/p/5690241.html

参考资料:
如何把本地项目上传到Github
git clone命令
Git怎么推送本地分支到远程新分支上面去?

Git如何把本地代码推送到远程仓库
https://blog.csdn.net/caogos/article/details/78261008

新建并强推一条分支到远程仓库

git push git@gitlab.sinocbd.local:application-group/local-official.git fe --force

修改用户名 和 邮箱地址

查看用户名和邮箱地址:

$ git config user.name

$ git config user.email

修改用户名和邮箱地址:

$ git config --global user.name "username"

$ git config --global user.email "email"

https://www.cnblogs.com/zt007/p/6140855.html

相关文章

网友评论

      本文标题:GIT 笔记

      本文链接:https://www.haomeiwen.com/subject/xrwveftx.html