学习笔记,来自慕课网课程"/>
Git学习笔记,来自慕课网课程
下载windows git
双击安装,一直下一步,完成。
git是分布式控制版本系统
配置用户信息
git config --global user.name "xxx"
git config --global user.email "xxx"
打开Git Bath
不同windows 系统打开方式可能不同
查看git信息(用户名,密码)
git config --list
客户端GUI界面使用Sourcetree
下载Sourcetree
/
参照人家的安装Sourcetree教程
Sourcetree项目查看地址
初始化版本库
git init
添加文件到版本库
git add
git commit
查看仓库状态
git status
查看仓库状态
- 所在分支为master
- (没有要提交的内容,工作树已清除)所有本地的修改都已经提交到当前的分支
把暂存区的修改回退到工作区
git reset HEAD bash_demo.txt
确认回退工作区的内容
git checkout -- bash_demo.txt
远程仓库
创建SSH key
ssh-keygen -t rsa -C "邮箱"
添加远程仓库
本地仓库init之后关联远程仓库
git remote add origin git@github:xxxx
--(allow-unrelated-histories)允许不相关的历史记录
git pull origin master --allow-unrelated-histories
推到远程仓库并指定分支master
git push -u origin master
克隆仓库
git clone git@github:xxxx
标签管理
查看所有标签
git tag
创建标签
git tag name
指定提交信息
git tag -a name -m "comment"
删除标签
git tag -d name
标签发布
git push origin name
git cat 查看文件命令乱码
cat test.txt | iconv -f GBK -t UTF-8
windows环境下新建.txt文件,使其默认以UTF-8编码
参照博客使用Notepad++创建.txt文件
or create a new repository on the command line
echo "# 2019-5-13-test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin .git
git push -u origin master
or push an existing repository from the command line
git remote add origin .git
git push -u origin master
更多推荐
Git学习笔记,来自慕课网课程
发布评论