Ubuntu下创建本地分支并同步到远程

allen@worker-005:~/git/hardware$ git branch 
  master
* parking-lot-lock
allen@worker-005:~/git/hardware$ git branch --
--abbrev=            --merged             --set-upstream-to=
--color              --no-abbrev          --track 
--contains           --no-color           --unset-upstream 
--edit-description   --no-merged          --verbose 
--list               --no-track           
allen@worker-005:~/git/hardware$ git branch --set-upstream-to=origin/parking-lot-lock
error: the requested upstream branch 'origin/parking-lot-lock' does not exist
hint: 
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint: 
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
allen@worker-005:~/git/hardware$ git branch 
  master
* parking-lot-lock
allen@worker-005:~/git/hardware$ git checkout
allen@worker-005:~/git/hardware$ git branch 
  master
* parking-lot-lock
allen@worker-005:~/git/hardware$ git che
checkout      cherry        cherry-pick   
allen@worker-005:~/git/hardware$ git chechout parking-lot-lock
git: 'chechout' is not a git command. See 'git --help'.

Did you mean this?
	checkout
allen@worker-005:~/git/hardware$ git checkout parking-lot-lock
Already on 'parking-lot-lock'
allen@worker-005:~/git/hardware$ git branch 
  master
* parking-lot-lock
allen@worker-005:~/git/hardware$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
allen@worker-005:~/git/hardware$ git branch 
* master
  parking-lot-lock
allen@worker-005:~/git/hardware$ git checkout parking
error: pathspec 'parking' did not match any file(s) known to git.
allen@worker-005:~/git/hardware$ ls
01-document  02-source  README.md
allen@worker-005:~/git/hardware$ ll
total 20
drwxrwxr-x 5 allen allen 4096 Jan 24 15:46 ./
drwxrwxr-x 5 allen allen 4096 Jan 24 15:45 ../
drwxrwxr-x 2 allen allen 4096 Jan 24 15:46 01-document/
drwxrwxr-x 2 allen allen 4096 Jan 24 15:46 02-source/
drwxrwxr-x 8 allen allen 4096 Jan 24 16:03 .git/
-rw-rw-r-- 1 allen allen    0 Jan 24 15:46 README.md
allen@worker-005:~/git/hardware$ git branch 
* master
  parking-lot-lock
allen@worker-005:~/git/hardware$ git checkout parking-lot-lock
Switched to branch 'parking-lot-lock'
allen@worker-005:~/git/hardware$ git branch 
  master
* parking-lot-lock
allen@worker-005:~/git/hardware$ git branch --set-upstream-to=origin/parking-lot-lock
error: the requested upstream branch 'origin/parking-lot-lock' does not exist
hint: 
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint: 
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
allen@worker-005:~/git/hardware$ git push origin
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

fatal: The current branch parking-lot-lock has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin parking-lot-lock

allen@worker-005:~/git/hardware$ git push --
--all                  --force-with-lease     --repo=
--delete               --mirror               --set-upstream 
--dry-run              --prune                --tags 
--follow-tags          --quiet                --verbose 
--force                --receive-pack=        
--force-with-lease=    --recurse-submodules=  
allen@worker-005:~/git/hardware$ git push --set-upstream origin parking-lot-lockTotal 0 (delta 0), reused 0 (delta 0)
remote: 
remote: To create a merge request for parking-lot-lock, visit:
remote:   https://g5.iot-sw.net/company/university/study/hardware/merge_requests/new?merge_request%5Bsource_branch%5D=parking-lot-lock
remote: 
To git@g5.iot-sw.net:company/university/study/hardware.git
 * [new branch]      parking-lot-lock -> parking-lot-lock
Branch parking-lot-lock set up to track remote branch parking-lot-lock from origin.
allen@worker-005:~/git/hardware$ git branch 
  master
* parking-lot-lock
allen@worker-005:~/git/hardware$ git che
checkout      cherry        cherry-pick   
allen@worker-005:~/git/hardware$ git checkout parking-lot-lock
Already on 'parking-lot-lock'
Your branch is up-to-date with 'origin/parking-lot-lock'.
allen@worker-005:~/git/hardware$ git branch 
  master
* parking-lot-lock
allen@worker-005:~/git/hardware$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
allen@worker-005:~/git/hardware$ git branch electrostatic-and-lightning-protection-design
allen@worker-005:~/git/hardware$ git push --
--all                  --force-with-lease     --repo=
--delete               --mirror               --set-upstream 
--dry-run              --prune                --tags 
--follow-tags          --quiet                --verbose 
--force                --receive-pack=        
--force-with-lease=    --recurse-submodules=  
allen@worker-005:~/git/hardware$ git branch 
  electrostatic-and-lightning-protection-design
* master
  parking-lot-lock
allen@worker-005:~/git/hardware$ git push --electrostatic-and-lightning-protection-design
error: unknown option `electrostatic-and-lightning-protection-design'
usage: git push [<options>] [<repository> [<refspec>...]]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --repo <repository>   repository
    --all                 push all refs
    --mirror              mirror all refs
    --delete              delete refs
    --tags                push tags (can't be used with --all or --mirror)
    -n, --dry-run         dry run
    --porcelain           machine-readable output
    -f, --force           force updates
    --force-with-lease[=<refname>:<expect>]
                          require old value of ref to be at this value
    --recurse-submodules[=<check|on-demand|no>]
                          control recursive pushing of submodules
    --thin                use thin pack
    --receive-pack <receive-pack>
                          receive pack program
    --exec <receive-pack>
                          receive pack program
    -u, --set-upstream    set upstream for git pull/status
    --progress            force progress reporting
    --prune               prune locally removed refs
    --no-verify           bypass pre-push hook
    --follow-tags         push missing but relevant tags
    --signed[=<yes|no|if-asked>]
                          GPG sign the push
    --atomic              request atomic transaction on remote side

allen@worker-005:~/git/hardware$ git push --set-upstream origin electrostatic-and-lightning-protection-design
Total 0 (delta 0), reused 0 (delta 0)
remote: 
remote: To create a merge request for electrostatic-and-lightning-protection-design, visit:
remote:   https://g5.iot-sw.net/company/university/study/hardware/merge_requests/new?merge_request%5Bsource_branch%5D=electrostatic-and-lightning-protection-design
remote: 
To git@g5.iot-sw.net:company/university/study/hardware.git
 * [new branch]      electrostatic-and-lightning-protection-design -> electrostatic-and-lightning-protection-design
Branch electrostatic-and-lightning-protection-design set up to track remote branch electrostatic-and-lightning-protection-design from origin.
allen@worker-005:~/git/hardware$ git branch 
  electrostatic-and-lightning-protection-design
* master
  parking-lot-lock
allen@worker-005:~/git/hardware$ 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值