git

134 阅读1分钟

git 修改gitignore无效

新增的忽略文件没有生效,是因为git是有缓存的,而之前的文件在缓存中,并不会清除掉,还会继续提交,所以更新.gitignore文件,要清除缓存文件

git rm -r --cached .
git add .
git commit -m 'update .gitignore'

git 添加密钥 ssh-add id_rsa 问题:Could not open a connection to your authentication agent

ssh-agent bash

git branch 查看所有分支,、 git add . 提交分支 git commit -m 'xxx' git push

git status // 查看修改的状态 git branch -a // 查看所有分支 git branch test // 创建新分支test

1、进入要合并的分支(如开发分支合并到master,则进入master目录) git checkout master git pull

2、查看所有分支是否都pull下来了 git branch -a

3、使用merge合并开发分支 git merge 分支名

4、查看合并之后的状态 git status

5、有冲突的话,通过IDE解决冲突;

6、解决冲突之后,将冲突文件提交暂存区 git add 冲突文件

7、提交merge之后的结果 git commit

如果不是使用git commit -m “备注” ,那么git会自动将合并的结果作为备注,提交本地仓库;

8、本地仓库代码提交远程仓库 git push

  1. git 创建新分支并切换到当前分支
git checkout -b li
他是

git branch li git checkout li 这两条命令的简写