github团队使用记录

Last login: Sat Nov 4 09:20:15 on ttys000
bogon:~ neveszhang$ git clone git@github.com:031502243/Classmate-book.git
Cloning into 'Classmate-book'...
Enter passphrase for key '/Users/neveszhang/.ssh/id_rsa':
remote: Counting objects: 133, done.
remote: Compressing objects: 100% (92/92), done.
remote: Total 133 (delta 14), reused 128 (delta 12), pack-reused 0
Receiving objects: 100% (133/133), 817.46 KiB | 230.00 KiB/s, done.
Resolving deltas: 100% (14/14), done.

bogon:~ neveszhang$ cd classmate-book
bogon:classmate-book neveszhang$ ls
Classmate README.md
bogon:classmate-book neveszhang$ git remote -v
origin git@github.com:031502243/Classmate-book.git (fetch)
origin git@github.com:031502243/Classmate-book.git (push)
bogon:classmate-book neveszhang$ git remote add upstrean git@github.com:2017FZU/Classmate-book.git //额..拼写错误造成了非常多的尴尬
bogon:classmate-book neveszhang$ git remote -v
origin git@github.com:031502243/Classmate-book.git (fetch)
origin git@github.com:031502243/Classmate-book.git (push)
upstrean git@github.com:2017FZU/Classmate-book.git (fetch)
upstrean git@github.com:2017FZU/Classmate-book.git (push)
bogon:classmate-book neveszhang$ git fetch upstream
fatal: 'upstream' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

bogon:classmate-book neveszhang$ ls
Classmate README.md
bogon:classmate-book neveszhang$
bogon:classmate-book neveszhang$ git branch

  • master
    bogon:classmate-book neveszhang$ git branch -a
  • master
    remotes/origin/Booomshaker
    remotes/origin/HEAD -> origin/master
    remotes/origin/How-Come
    remotes/origin/K
    remotes/origin/NevesLalala
    remotes/origin/hbing
    remotes/origin/hsh1234
    remotes/origin/master
    remotes/origin/winforbest
    remotes/origin/zora02

bogon:classmate-book neveszhang$ git checkout -b Neveslalala origin/master
Branch Neveslalala set up to track remote branch master from origin.
Switched to a new branch 'Neveslalala'
bogon:classmate-book neveszhang$ ls
Classmate README.md

bogon:classmate-book neveszhang$ git checkout -b Neves origin/NevesLalala
Branch Neves set up to track remote branch NevesLalala from origin.
Switched to a new branch 'Neves'

bogon:classmate-book neveszhang$ git remote add upstrean git@github.com:2017FZU/Classmate-book.git //upstrean
fatal: remote upstrean already exists.
bogon:classmate-book neveszhang$ git remote add upstream git@github.com:2017FZU/Classmate-book.git //upstream
bogon:classmate-book neveszhang$ git remote -v
origin git@github.com:031502243/Classmate-book.git (fetch)
origin git@github.com:031502243/Classmate-book.git (push)
upstream git@github.com:2017FZU/Classmate-book.git (fetch)
upstream git@github.com:2017FZU/Classmate-book.git (push)
upstrean git@github.com:2017FZU/Classmate-book.git (fetch)
upstrean git@github.com:2017FZU/Classmate-book.git (push)
bogon:classmate-book neveszhang$ git fetch upstream
Enter passphrase for key '/Users/neveszhang/.ssh/id_rsa':
remote: Counting objects: 93, done.
remote: Compressing objects: 100% (51/51), done.
remote: Total 93 (delta 32), reused 78 (delta 25), pack-reused 0
Unpacking objects: 100% (93/93), done.
From github.com:2017FZU/Classmate-book

  • [new branch] Booomshaker -> upstream/Booomshaker
  • [new branch] How-Come -> upstream/How-Come
  • [new branch] K -> upstream/K
  • [new branch] NevesLalala -> upstream/NevesLalala
  • [new branch] hbing -> upstream/hbing
  • [new branch] hsh1234 -> upstream/hsh1234
  • [new branch] master -> upstream/master
  • [new branch] winforbest -> upstream/winforbest
  • [new branch] zora02 -> upstream/zora02

//把要上传的文件放到classmate-book文件夹下

bogon:classmate-book neveszhang$ git add .
bogon:classmate-book neveszhang$ git commit -m "ui&sql method"
[Neves 81f71e2] ui&sql method
7 files changed, 24 insertions(+)
create mode 100644 .DS_Store
create mode 100644 ISqlmethods.java
create mode 100644 ui/7AE27C5C3668BA8686713856E3720E51.jpg
create mode 100644 ui/917EAC099B5888E584D34818837E2665.jpg
create mode 100644 ui/9E56D480EDCEDBC1B2DF4302503A6F2A.jpg
create mode 100644 ui/B7ABABC02B7A82A97CBAC204D2978CB1.jpg
create mode 100644 ui/E338393866D3D10874A72F63128299DD.jpg
bogon:classmate-book neveszhang$ git push
fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use

git push origin HEAD:NevesLalala

To push to the branch of the same name on the remote, use

git push origin Neves  //选择这条语句..不小心新建了一个分支

To choose either option permanently, see push.default in 'git help config'.
bogon:classmate-book neveszhang$ git brancj
git: 'brancj' is not a git command. See 'git --help'.

The most similar command is
branch
bogon:classmate-book neveszhang$

bogon:classmate-book neveszhang$ git checkout -b NevesLalala origin/NevesLalala
fatal: A branch named 'NevesLalala' already exists.
bogon:classmate-book neveszhang$ git checkout NevesLalala
error: Your local changes to the following files would be overwritten by checkout:
.DS_Store
Please commit your changes or stash them before you switch branches.
Aborting

bogon:classmate-book neveszhang$ git push origin Neves
Enter passphrase for key '/Users/neveszhang/.ssh/id_rsa':
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 75.24 KiB | 18.81 MiB/s, done.
Total 10 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To github.com:031502243/Classmate-book.git

  • [new branch] Neves -> Neves
    //登录自己的girhub上就能查看这个clone下来的库了,然后pull request
原文地址:https://www.cnblogs.com/neveslalala/p/7794043.html