git 基本命令 (常用)

 http://www.zhixing123.cn/ubuntu/37865.html    参考的这个网址

他这里有个错误:id_rsa.pub 应该复制这个 而不是id_rsa

 1341  git init
 1342  git add README.md
 1343  git commit -m "first commit"
 1344  git remote add origin git@github.com:tidalmelon/seven.git
 1345  git push -u origin master



2132  git init
 2133  git add .
 2134  git commit -m "first commit"
 2135  git remote add origin git@github.com:tidalmelon/cutvegetables.git
 2136  git push -u origin master


平时提交
git status
git add -A
git commit -m 'message'
git push



修改或添加文件了怎么办么?
 2066  git commit -m 'modify question.py'
 2067  git push -u origin master

root@localhost:/home/projects/cutvegetables# git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: myoa/daily/2014-04-03.txt
# new file: myoa/daily/2014-04-04.txt
# modified: myoa/question.py
oot@localhost:/home/projects/cutvegetables# git commit -m 'modify question.py'
[master 80a1c93] modify question.py
3 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 myoa/daily/2014-04-03.txt
create mode 100644 myoa/daily/2014-04-04.txt
oot@localhost:/home/projects/cutvegetables# git push -u origin master
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 855 bytes, done.
Total 7 (delta 1), reused 0 (delta 0)
To git@github.com:tidalmelon/cutvegetables.git
1b18e18..80a1c93 master -> master
Branch master set up to track remote branch master from origin.
root@localhost:/home/projects/cutvegetables# 
在另外一台电脑上将代码拉下来:
[root@slave2 cutvegetables]# git pull origin
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 1), reused 7 (delta 1)
Unpacking objects: 100% (7/7), done.
From github.com:tidalmelon/cutvegetables
1b18e18..80a1c93 master -> origin/master
Updating 1b18e18..80a1c93
Fast-forward
myoa/daily/2014-04-03.txt | 8 ++++++++
myoa/daily/2014-04-04.txt | 8 ++++++++
myoa/question.py | 2 +-
3 files changed, 17 insertions(+), 1 deletions(-)
create mode 100644 myoa/daily/2014-04-03.txt
create mode 100644 myoa/daily/2014-04-04.txt
今天的新情况,

我在两个客户端都改了代码,这怎么办?
答案:
先Push一个上去 然后fetch到另一台电脑的本地 Merge 
















原文地址:https://www.cnblogs.com/i80386/p/3312095.html