【Git】初学者的Git教程
这份文件是给初学者的!!
1. 【Git 命令流程】(Git
Git流程如下。
你必须记住这一点。
# check your status
1. git status
# upload modified file to staging area
2. git add .
# commit changes
3. git commit -m "commit massage"
# check your commit log
4. git log
(If you want to **exit** type q.)

2. 【输出】git状态命令
本章展示了git status的输入/输出。
-
- 没有 Git 仓库
-
- 没有需要更改的内容
-
- 预添加(需要添加)
- 预提交(需要提交)
(1). 非Git存储库

这个输出表示”不是一个git仓库”。
你可能在一个不同的目录或者还没有初始化git。检查当前目录。
# check current directory command
pwd
如果您处于正确的位置以跟踪Git,您应该输入初始化命令。
git init
(2). 无需改动

这个输出表示“无需更改”。
有以下两种可能性。
(1) 你已经提交了更改。
(2) 你没有保存本地文件的更改。
检查你的本地文件!
(3). 预先添加

这个输出提示说”本地文件已修改,需要添加或存储”。
如果你想跟踪本地文件,你应该添加这些文件。
# "." means all-file
git add .
# or
git add file-name
(4). 预先承诺

这个输出表示“您的更改已经添加到暂存区”。
所以您应该提交这些更改。
# "-m" means message
git commit -m "your change log message"
# or
git commit
3. 【其他指令和设置】
「命令」添加远程
如果你想要添加远程仓库,你需要输入这个指令。
# add remote repository
git remote add origin remote-repository path
# For example
# git remote add origin git@bitbucket.org:banaoh/toy_app.git
[指令] 删除远程
如果你不想添加错误的远程代码仓库,你应该在下面键入。
# check your set remote path
git remote -v
# if the path wrong
git remote rm origin
[別名] 快捷 git 命令
如果你觉得键入完整命令很累,你可以设置别名。”别名”就像快捷方式 :)。
vim ~/.gitconfig
# and
[alias]
st = status
ci = commit
co = checkout