git 六行配置
git config --global user.name 你的英文名
git config --global user.email 你的邮箱
git config --global push.default simple
git config --global core.quotepath false
git config --global core.editor "code --wait"
git config --global core.autocrlf input
git config --global --list
查看当前目录绝对路径 pwd
查看当前目录内容 ls
查看指定目录内容 ls路径
查看文件内容
cat路径(文件全部内容) head路径(文件前xx行) tail路径(文件后xx行) less路径(实时滚动查看)
head xxx.txt -n 15 (查看前15行)
创建目录
touch 1.txt
echo hi > 1.txt 一个>是覆盖
echo hihi >> 1.txt 两个是追加
echo -e "1\n2" > 1.txt
mkdir a
mkdir -p a/b/c 递归创建
touch 1.txt 2.txt
mkdir a b
rm 删除命令 rm -r删除文件
移动和重命名 mv
git add. 和 git commit -v
git config
git init 创建 .git
git add 选者要提交的内容
gitignore 文件描述不可提交的内容
git commit -v 用来提交
git log 用来查看历史
git reset --hard xxxxxx 切换版本查看
git reflog 用来查看所有历史版本
git merge 合并分支
git branch 基于当前创建一个新的时间线 分支
gir checkout 用于切换另一个分支
git stash (pop)
发现冲突 conflict 提示
使用git status -sb 查看哪个/那些文件冲突
git add/git commit/ [git pull] / git push 四连操作
git clone 下载代码 /git pull 更新下载 / git push 上传
git remote add origin git @xxxxxxx在本地添加远程仓库地址
git push -u origin master 上传代码
git push -u origin2 master 同时上传第二个代码
git blame 相对路径 看代码当时写的时间