Git是目前世界上最先进的分布式版本控制系统,可以有效、高速的处理从很小到非常大的项目版本管理。(应付性的简介)
先开始第一次上传:
1.创建本地仓库,再添加一下远程仓库


2.在本地添加一个文件test.txt,用 git status 查看一下目前的状态,会看到这个有一个文件是标红状态,这就表示这个文件是已修改未add暂存到本地的(git status这个命令是以后会经常用到的)

3.这里就用git add 把新增的文件添加到暂存区,没有什么提示的话即表示成功了,接下来再用git status查看状态确认一下,绿色就是提交到暂存区了

4.接下来就是用git commit -m '第一次提交‘(-m 参数表示可以直接输入后面的),这样就把新增的文件提交到本地库里面了,然后用git status看一下状态,会提示分支是干净的。commit更多的参数可以自行去看一下

5.把代码提交到远程仓库,需要先连接远程仓库,使用git remote add *****,如果没有提示就代表成功了,然后可以用remote -v 查看连接

6.然后使用git push origin master 推到远程仓库

如果推送到远程的分支不想叫master可以使用git push origin master:*** 这样操作,名字随你定义

线上提交的内容

git 还有很多方便的命令:
git branch -a 查看所有分支

git branch test 创建本地分支,之后可以用git checkout test切换到该分支

git clone **** 克隆一个版本库到一个新目录
git log 显示提交日志
git clean 删除文件命令
以上的git操作可以应付个人的单独操作
网友评论