git

初次安装后需全局设置用户名及email

git config --global --list

列出当前全局系统配置,如果需要列举当前仓库的配置,可以吧global更换为local

1
2
git config --global user.name "your name"
git config --global user.email "your email address"

reset

git log

打印出log后按Q退出,log里面会有hash字符串,复制以后git reset hasn字符串,可撤销操作。

git ignore

在git目录下新建 .gitgnore文件

1
2
/node_modules/
!/node_modules/test/ //node_modules里面只有test文件夹正常提交

git branch

新建分支

1
git branch test

切换分支

1
git checkout test

分支合并

1
git merge test

拉取指定分支代码

git pull origin test

推送指定分支代码

git push origin test