xuyaxiu 发表于 2018-9-18 06:00:56

三十分钟学习git的常用命令

# git checkout test  
Switched to branch 'test'
  
# touch 10.txt
  
# git add 10.txt
  
# git commit -a -m 'add 10.txt'
  
add 10.txt
  
Committer: root
  
Your name and email address were configured automatically based
  
on your username and hostname. Please check that they are accurate.
  
You can suppress this message by setting them explicitly:
  

  
    git config --global user.name "Your Name"
  
    git config --global user.email you@example.com
  

  
If the identity used for this commit is wrong, you can fix it with:
  

  
    git commit --amend --author='Your Name '
  

  
0 files changed, 0 insertions(+), 0 deletions(-)
  
create mode 100644 10.txt
  
# ls 10.txt
  
10.txt
  
# git checkout master
  
Switched to branch 'master'
  
# ls 10.txt
  
ls: cannot access 10.txt: No such file or directory
  
# git merge test master
  
Trying simple merge with test
  
Already up-to-date with master
  
Merge made by octopus.
  
0 files changed, 0 insertions(+), 0 deletions(-)
  
create mode 100644 10.txt
  
# ls 10.txt
  
10.txt
  
# git push origin
  
Counting objects: 4, done.
  
Compressing objects: 100% (3/3), done.
  
Writing objects: 100% (3/3), 363 bytes, done.
  
Total 3 (delta 2), reused 0 (delta 0)
  
Unpacking objects: 100% (3/3), done.
  
To /var/ngint.git/
  
   8c40602..c66f7c2master -> master
  

  
这时就能在另一个副本,下载最新文件了:
  
# cd /opt/mynginx/
  
# git pull origin
  
remote: Counting objects: 4, done.
  
remote: Compressing objects: 100% (3/3), done.
  
remote: Total 3 (delta 2), reused 0 (delta 0)
  
Unpacking objects: 100% (3/3), done.
  
From /var/ngint
  
   8c40602..c66f7c2master   -> origin/master
  
Updating 8c40602..c66f7c2
  
Fast-forward
  
0 files changed, 0 insertions(+), 0 deletions(-)
  
create mode 100644 10.txt
  
#


页: [1]
查看完整版本: 三十分钟学习git的常用命令