美文网首页
使用IDEA上传项目到github(windows)并建立分支

使用IDEA上传项目到github(windows)并建立分支

作者: AUL | 来源:发表于2017-11-28 15:45 被阅读35次

C:\Users\Administrator\Desktop\umall>git init
Initialized empty Git repository in C:/Users/Administrator/Desktop/umall/.git/

C:\Users\Administrator\Desktop\umall>git status

On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .gitignore
        README.md
        pom.xml
        src/

nothing added to commit but untracked files present (use "git add" to track)

C:\Users\Administrator\Desktop\umall>git add .

C:\Users\Administrator\Desktop\umall>git status

On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   .gitignore
        new file:   README.md
        new file:   pom.xml
        new file:   src/main/webapp/WEB-INF/web.xml
        new file:   src/main/webapp/index.jsp

C:\Users\Administrator\Desktop\umall>git commit -am 'f init project'
fatal: Paths with -a does not make sense.

需要注意的是在windows系统中需要使用双引号

C:\Users\Administrator\Desktop\umall>git commit -am "f init project"
[master (root-commit) 69f1f68] f init project
5 files changed, 74 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
create mode 100644 pom.xml
create mode 100644 src/main/webapp/WEB-INF/web.xml
create mode 100644 src/main/webapp/index.jsp

C:\Users\Administrator\Desktop\umall>git remote add origin https://github.com/anhengchangyua/umall.git

C:\Users\Administrator\Desktop\umall>git branch

  • master

C:\Users\Administrator\Desktop\umall> git push -u origin master

Username for 'https://github.com': 188851312@qq.com
Password for 'https://188851312@qq.com@github.com':
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (11/11), 1.23 KiB | 631.00 KiB/s, done.
Total 11 (delta 0), reused 0 (delta 0)
To https://github.com/anhengchangyua/umall.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

( 建立分支!)C:\Users\Administrator\Desktop\umall>git branch

  • master

C:\Users\Administrator\Desktop\umall>git branch -r
origin/master

C:\Users\Administrator\Desktop\umall>git checkout -b v1.0 origin/master
Switched to a new branch 'v1.0'
Branch 'v1.0' set up to track remote branch 'master' from 'origin'.

C:\Users\Administrator\Desktop\umall>git brach

git: 'brach' is not a git command. See 'git --help'.

The most similar command is
       branch

C:\Users\Administrator\Desktop\umall>git branch
master

  • v1.0

C:\Users\Administrator\Desktop\umall>git push origin HEAD -u

Username for 'https://github.com': 188851312@qq.com
Password for 'https://188851312@qq.com@github.com':
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/anhengchangyua/umall.git
* [new branch]      HEAD -> v1.0
Branch 'v1.0' set up to track remote branch 'v1.0' from 'origin'.

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

相关文章

网友评论

      本文标题:使用IDEA上传项目到github(windows)并建立分支

      本文链接:https://www.haomeiwen.com/subject/lyhebxtx.html