下载代码
gitclone + url
Mast 下更换单分支:
git checkout feature/perf_409035(git 分支)
git checkout oms-P_6081
status –git status
查看已暂存和未暂存的更新
add --git add file
跟踪新文件
pull --git pull参数可省略
更新代码
commit –git commit
提交表示该文件已经被安全地保存在本地数据库中了
push – git push [remote-name] [branch-name]
推送到远程分支
diff --git diff
比较当前工作目录(working directory)和staging area(存储区域)的文件差别
rm --git rm file
删除文件,并且从暂存区删除
--git rm--cached file 从暂存区删除
Git pull 更新代码
git提交流程: git pull——git status——git add——git commit(写注释,退出 : 点击ESC 然后输入 :wq)——git push 。
. 文件状态
一般仓库中的文件可能存在于这三种状态:
1)Untracked files → 文件未被跟踪;
2)Changes to be committed → 文件已暂存,这是下次提交的内容;
3) Changes bu not updated → 文件被修改,但并没有添加到暂存区。如果 commit 时没有带 -a 选项,这个状态下的文件不会被提交。
$git commit -a -m "commit info"
git commit -m "提交" “” 注释内容
git commit: git commit 提交的是暂存区里面的内容,也就是 Changes to be committed 中的文件。
git commit -a 除了将暂存区里的文件提交外,还提交 Changes bu not updated 中的文件。