[git]基本命令
1、windows下载git工具[https://git-for-windows.github.io]
2、配置GIT用户名[git config --global user.name "ada"][git config --global user.email "123@126.com"]
3、创建目录[makdir leargit][cd][cd ..][pwd]
4、创建并初始化git库,进入目录后再执行[git init]
5、添加[git add xxx.file] 上传[git commit -m “描述说明”]
6、文件操作[git status][git diff xxx.file][git log --pretty=oneline][git reflog]
7、文件回退[git reset --hard HEAD^ xxx.file]
8、文件获取[git checkout -- xxx.file]
9、文件删除[git rm xxx.file][git commit -m"delect file"]
10、文件查看 [vi ***.file],退出文件[:q]
[git]分支操作
1、创建并切换分支[git checkout -b branch-name]==[git branch branch-name]+[git checkout branch-name]{切换分支}
2、查看当前有哪些分支 [git branch]
3、[git checkout branch-name][git checkout master],是操作最后的一个文件
4、合并当前操作的文件 branch到master [git merge branch-name][git merge --no-ff -m "comment" branch-name]
{遇到冲突,先解决冲突。[git status]->[git log --graph --pretty=oneline --abbrev-commit]}
{master上 重新add、commit}
5、删除分支[git branch -d branch-name] 强行删除分支[git branch -D branch-name]
6、暂存工作环境 [git stash] 还原工作环境[git stash list]->[git stash pop],或者指定还原[git stash apply stash@{0}]->[git stash drop]
[git]远程库的操作
1、创建KEY[ssh-keygen -t rsa -C"123@126.com"]
2、创建并关联[git remote add origin git@github.com:Aiwenada/***.git]
3、远程推送[git push -u origin master{branch-name}],后续可用[git push origin master{branch-name}]
4、远程克隆[git clone git@github.com:Aiwenada/***.git]
5、获取远程库分支[git checkout -b branch-name origin/branch-name]
6、本地分支与远程分支关联[git branch --set-upstream branch-name origin/brach-name]
7、抓取远程[git pull]
8、获取远程仓库的详细信息[git remote -v]
[git]标签操作
1、获取标签[git tag]
2、创建标签[git tag {tag-name} {commitID}] 默认打在最后一次commit
3、查看标签[git show {tag-name}]
github.com操作
1、fork获取开源代码到自己的github
1、windows下载git工具[https://git-for-windows.github.io]
2、配置GIT用户名[git config --global user.name "ada"][git config --global user.email "123@126.com"]
3、创建目录[makdir leargit][cd][cd ..][pwd]
4、创建并初始化git库,进入目录后再执行[git init]
5、添加[git add xxx.file] 上传[git commit -m “描述说明”]
6、文件操作[git status][git diff xxx.file][git log --pretty=oneline][git reflog]
7、文件回退[git reset --hard HEAD^ xxx.file]
8、文件获取[git checkout -- xxx.file]
9、文件删除[git rm xxx.file][git commit -m"delect file"]
10、文件查看 [vi ***.file],退出文件[:q]
[git]分支操作
1、创建并切换分支[git checkout -b branch-name]==[git branch branch-name]+[git checkout branch-name]{切换分支}
2、查看当前有哪些分支 [git branch]
3、[git checkout branch-name][git checkout master],是操作最后的一个文件
4、合并当前操作的文件 branch到master [git merge branch-name][git merge --no-ff -m "comment" branch-name]
{遇到冲突,先解决冲突。[git status]->[git log --graph --pretty=oneline --abbrev-commit]}
{master上 重新add、commit}
5、删除分支[git branch -d branch-name] 强行删除分支[git branch -D branch-name]
6、暂存工作环境 [git stash] 还原工作环境[git stash list]->[git stash pop],或者指定还原[git stash apply stash@{0}]->[git stash drop]
[git]远程库的操作
1、创建KEY[ssh-keygen -t rsa -C"123@126.com"]
2、创建并关联[git remote add origin git@github.com:Aiwenada/***.git]
3、远程推送[git push -u origin master{branch-name}],后续可用[git push origin master{branch-name}]
4、远程克隆[git clone git@github.com:Aiwenada/***.git]
5、获取远程库分支[git checkout -b branch-name origin/branch-name]
6、本地分支与远程分支关联[git branch --set-upstream branch-name origin/brach-name]
7、抓取远程[git pull]
8、获取远程仓库的详细信息[git remote -v]
[git]标签操作
1、获取标签[git tag]
2、创建标签[git tag {tag-name} {commitID}] 默认打在最后一次commit
3、查看标签[git show {tag-name}]
github.com操作
1、fork获取开源代码到自己的github