$ git commit -m ‘Initial upload of the project’
*** Please tell me who you are.
Run
git config –global user.email “you@example.com”
git config –global user.name “Your Name”
to set your account’s default identity.
Omit –global to set the identity only in this repository.
fatal: empty ident not allowed
5、更改文件和提交改动
编辑文件、添加或者删除了一些字段
$ vi Orangebugs.java
查看和GIT仓库中的文件相比有了那些改动
$ git diff
diff –git a/Orangebugs.java b/Orangebugs.java
index 6166ed1..fd82d32 100644
— a/Orangebugs.java
+++ b/Orangebugs.java
@@ -2,7 +2,7 @@
- public counter=10
+ public counter=55
或者,简单一点的方法是使用 git commit -a 把上面两个命令合二为一。
6、查看状态和查看注释
如果本地的文件和远端GIT仓库上的文件相比没有任何改动,则
$ git status
# On branch master
nothing to commit (working directory clean)
如果本地做了改动但是没有提交,则
$ git status
# On branch master
# Changes not staged for commit:
# (use “git add …” to update what will be committed)
# (use “git checkout — …” to discard changes in working directory)
#
# modified: Orangebugs.java
#
no changes added to commit (use “git add” and/or “git commit -a”)
另外,可以用下面的命令查看文件历史和以往的注释
$ git log Orangebugs.java
commit c919ced7f42f4bc06d563c1a1eaa107f2b2420d5
Author: GIT Admin
Date: Sat Aug 13 22:54:57 2011 -0700
Added password strength meter functionality
commit c141b7bdbff429de35e36bafb2e43edc655e9957
Author: GIT Admin
Date: Sat Aug 13 20:08:02 2011 -0700
Initial upload of the project