git使用教程

1. git和svn区别

svn:集中式服务器
git:分布式服务器 

2. 初始化身份

git config --global user.name "hello"
git config --global user.email "hello@163.com"

3. 创建仓库

初始化仓库:git init
添加到仓库:git add filename
提交到仓库:git commit -m '注释'

4. 时光穿梭

查看仓库状态:git status
查看仓库状态(具体改变内容):git diff
查看历史版本:git log
查看历史版本:git log --pretty=oneline
回到历史版本:git reset --hard HEAD^
回到历史具体版本:git reset --hard 版本号
工作区和暂存区
删除文件:
    工作区删除:rm test.txt
    版本库删除:
        git rm test.txt
        git commit -m '删除文件'
    找回来文件:
        git checkout -- test.txt

5. 分支管理

创建与并切换分支:git checkout -b <name>
查看分支:git branch
创建分支:git branch <name>
切换分支:git checkout <name>
合并某分支到当前分支:git merge <name>
删除分支:git branch -d <name>

6. 推送到远程仓库

github平台:
       1.生成ssh
           ssh-keygen -t rsa -C "hello@163.com"
       2.关联github
       3.创建仓库
       4.把本地仓库的代码推送到远程仓库
           第一次推送:
               git remote add origin https://github.com/xYang98/fullcalendar_demo.git
			git push -u origin master
           以后:
               git push
gitee平台:
     1.克隆仓库:git clone https://gitee.com/yangJingYiBlog/practice.git
     2.上传操作
     3.多人协作:

7. 远程仓库的命令

git clone url
git push
git pull

8.详细学习地址

git详细学习地址

简易的命令行入门教程:

创建 git 仓库:
mkdir changgou-parent
cd changgou-parent
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/yangJingYiBlog/pra222ctice.git
git push -u origin master
已有仓库?
cd existing_git_repo
git remote add origin https://gitee.com/yangJingYiBlog/practice.git
git push -u origin master		

如果有错误,望大佬指出。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值