git学习
Posted rita-0204
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git学习相关的知识,希望对你有一定的参考价值。
首先要有个git仓库地址:http://171.1.1.1
申请git账号
新建项目---按提示依次填写项目名、项目描述、可见性(一般选Private)
按着提示输入命令:
打开终端或者git bash--进入项目文件目录
Git global setup--账号密码
git config --global user.name "rita" git config --global user.email "*****.com"
Create a new repository--新建库
git clone http://172.16.10.61/rita/my-test.git
cd my-test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder--现在的文件夹
cd existing_folder
git init 初始化
git remote add origin http://172.16.10.61/rita/my-test.git 远程添加仓库地址
git add .
git commit -m "Initial commit"
git push -u origin master 推送到主干
Existing Git repository--现有的git存储库
cd existing_repo
git remote rename origin old-origin 远程重命名
git remote add origin http://172.16.10.61/rita/my-test.git 添加文件到git上
git push -u origin --all 推送所有的
git push -u origin --tags 推送标签
输入git 获得命令帮助:
start a working area (see also: git help tutorial) 开始一个工作区域
clone Clone a repository into a new directory 将存储库克隆到新目录中
init Create an empty Git repository or reinitialize an existing one 创建一个空的Git存储库或重新初始化一个现有的
work on the current change (see also: git help everyday) 研究当前的变化
add Add file contents to the index 向索引中添加文件内容
mv Move or rename a file, a directory, or a symlink 移动或重命名文件、目录或符号链接
reset Reset current HEAD to the specified state 将当前磁头重置为指定状态
rm Remove files from the working tree and from the index 从工作树和索引中删除文件
examine the history and state (see also: git help revisions) 检查历史和状态
bisect Use binary search to find the commit that introduced a bug 使用二进制搜索查找引入bug的提交
grep Print lines matching a pattern 打印匹配模式的行
log Show commit logs 显示提交日志
show Show various types of objects 显示各种类型的对象
status Show the working tree status 显示工作树状态
grow, mark and tweak your common history 成长,标记和调整你的共同历史
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
以上是关于git学习的主要内容,如果未能解决你的问题,请参考以下文章
VSCode自定义代码片段15——git命令操作一个完整流程
GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段
GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段