代码管理工具之GIT:重新温习一下

https://www.yiibai.com/git/git_log.html

经验:

单元测试,
数据库sql 的值他不是字符串,你需要注意

 

用这个:当你git add以后想撤销就用这个

git reset HEAD benchmarks.rb

 

 

原理:只会删除缓存区文件,工作区文件不会改变
git rm --cache 文件名

不要用这个:它的原理是删除缓存区文件,工作区文件恢复到add之前
git restore <file>


别用
git rm -f 文件名

==========================================================

修改commit的信息
git commit --amend

=======================================================================

如果你写了代码,但是上个版本需要修改或者说需要rebase,你需要把你写的代码先隐藏起来,然后去处理那个

Cannot rebase: You have unstaged changes.

那说明你有修改过的文件
git stash
git pull --rebase (每次push之前最好这样做一次)
git push ....
之后用git stash pop stash

 

==========================================

 

先说一下:

git checkout master

git pull

解决冲突

git add . 

git commit -m "解决冲突+原先版本名字"

git checkout ws

git rebase master

如果冲突再解决

git add .

git commit -m "解决冲突"

git push origin -f ws

 

--------------------------------------------------------

git log

git rebase -i HEAD~2

 

然后将下面的pick   都改为  f    然后保存退出

 

就可以整合版本了

 

记着:没有上传的你可以随便整合

    上传到git的版本不要随便整合

 

 

 

=-----------------------------------------------------

推文件:

#创建并切换分支
git checkout -b ws

#查看状态
git status

#添加文件
git add .

#提交文件
git commit -m "添加接口"


#推上去
git push origin -f ws
----------------------------------------
拉文件:

#初始化
git init

#开始拉文件
git clone git@*********.git

#
git checkout -b ws

git pull origin ws

 

posted @ 2021-11-01 15:01    阅读(21)  评论(0编辑  收藏  举报