Git的使用
git初始化:
Welcome to Git (version 1.7.9-preview20120201)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
ASA_CHINA@ASA_CHINA-PC ~
$ cd /s/software/repository/git/
ASA_CHINA@ASA_CHINA-PC /s/software/repository/git
$ ls
ASA_CHINA@ASA_CHINA-PC /s/software/repository/git
$ git init --bare shared.git
Initialized empty Git repository in s:/software/repository/git/shared.git/
ASA_CHINA@ASA_CHINA-PC /s/software/repository/git
$
user1:
Welcome to Git (version 1.7.9-preview20120201)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1
$ git clone /s/software/repository/git/shared.git/ .
Cloning into '.'...
warning: You appear to have cloned an empty repository.
done.
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ git config user.name "liyunchao"
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ git config user.email "liyunchao@qq.com"
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ ls
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ ls -a
. .. .git
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ echo "my name is liyunchao" > index.jsp
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ ls
index.jsp
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ cd index.jsp
sh: cd: index.jsp: Not a directory
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ cat index.jsp
my name is liyunchao
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ git add index.jsp
warning: LF will be replaced by CRLF in index.jsp.
The file will have its original line endings in your working direc
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ git commit -m "liyunchao create the file"
[master (root-commit) 9248ed5] liyunchao create the file
warning: LF will be replaced by CRLF in index.jsp.
The file will have its original line endings in your working direc
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 index.jsp
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 229 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To s:/software/repository/git/shared.git/
* [new branch] master -> master
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ git pull
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From s:/software/repository/git/shared
9248ed5..5d65313 master -> origin/master
Updating 9248ed5..5d65313
Fast-forward
index.jsp | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ ls
index.jsp
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$ cat index.jsp
my name is liyunchao
asa add content
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user1 (master)
$
user2:
Welcome to Git (version 1.7.9-preview20120201)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user2
$ git clone /s/software/repository/git/shared.git/ .
Cloning into '.'...
done.
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user2 (master)
$ git config user.name "asa"
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user2 (master)
$ git config user.email "asa@gmail.com"
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user2 (master)
$ echo "asa add content" >> index.jsp
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user2 (master)
$ git add index.jsp
warning: LF will be replaced by CRLF in index.jsp.
The file will have its original line endings in your working directory.
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user2 (master)
$ git commit -m "asa update the file"
[master warning: LF will be replaced by CRLF in index.jsp.
The file will have its original line endings in your working directory.
5d65313] asa update the file
warning: LF will be replaced by CRLF in index.jsp.
The file will have its original line endings in your working directory.
1 files changed, 1 insertions(+), 0 deletions(-)
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user2 (master)
$ git push origin master
Counting objects: 5, done.
Writing objects: 100% (3/3), 273 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To s:/software/repository/git/shared.git/
9248ed5..5d65313 master -> master
ASA_CHINA@ASA_CHINA-PC /S/develop/workroom/user2 (master)
$
转载于:https://blog.51cto.com/asalinux/903403