(1)创建README.md文件

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ touch README.md

(2)创建.gitignore文件(用于忽略上传的文件)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#提交到码云上面忽略的东西配置
 
*.class
#package file
*.war
*.ear
*.orig
 
target/
.settings/
.project
.classpath
 
.idea/
/idea/
*.ipr
*.iml
*.iws
 
*.log
*.cache
*.diff
*.patch
*.tmp
 
.DS_Store
Thumbs.db

  

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ touch .gitignore

(3)初始化git

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)

$ git init
Initialized empty Git repository in F:/workspace/imallproject/.git/

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)

查看git状态:现在是在master上(一般分支开发主干合并)
$ git status
On branch master

(4)commit提示错误,先git add一下

Initial commit

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)

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git add .

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git status
On branch master

Initial commit

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

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git commit -am 'first commit '
[master (root-commit) 5ef0663] first commit
5 files changed, 65 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

git连接到码云仓库:

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git remote add origin git@git.oschina.net:marrymayun/imalllearning.git

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git branch
* master

(5)推送

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git push -u origin master
The authenticity of host 'git.oschina.net (120.55.226.24)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
fatal: Could not read from remote repository.

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

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git pull
The authenticity of host 'git.oschina.net (120.55.226.24)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'git.oschina.net,120.55.226.24' (ECDSA) to the list of known hosts.
warning: no common commits
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From git.oschina.net:marrymayun/imalllearning
* [new branch] master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> master

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git push -u -f origin master
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (11/11), 1.29 KiB | 0 bytes/s, done.
Total 11 (delta 0), reused 0 (delta 0)
To git@git.oschina.net:marrymayun/imalllearning.git
+ a5a27d2...5ef0663 master -> master (forced update)
Branch master set up to track remote branch master from origin.

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git branch
* master

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git branch -r
origin/master

在master下创建分支v1.0

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
$ git checkout -b v1.0 origin/master
Branch v1.0 set up to track remote branch master from origin.
Switched to a new branch 'v1.0'

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (v1.0)
$ git branch
master
* v1.0

推送到分支,我们在分支开发,主干合并

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (v1.0)
$ git push origin HEAD -u
Total 0 (delta 0), reused 0 (delta 0)
To git@git.oschina.net:marrymayun/imalllearning.git
* [new branch] HEAD -> v1.0
Branch v1.0 set up to track remote branch v1.0 from origin.

fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (v1.0)
$

完成:

至此在idea中初始化git完成。

最新文章

  1. ng1.3+表单验证&lt;AngularJs&gt;
  2. wubi安装ubuntukylin-14.04
  3. 安装Nvidia k80驱动步骤
  4. iOS学习之代码块(Block)
  5. MVP模式
  6. DLUTOJ1216
  7. 【JAVA网络流之TCP与UDP 】
  8. STM32上移植ds1307笔记
  9. CBA 赛程的笔记 - 北京首钢
  10. Mybatis案例
  11. Delphi编写自定义控件以及接口的使用(做了一个TpgDbEdit)
  12. 解决php的$美元符号与Zen Coding冲突问题
  13. opencv_形态学结构化元素对形态学图像处理的影响
  14. debian系统下安装ssh服务
  15. Android的多媒体框架OpenCore介绍
  16. mac隐藏或显示文件
  17. angularjs-1.3代码学习-$parse
  18. 怎么改变title属性的样式?
  19. 15.app后端怎么设计用户登录方案
  20. CSS3D 转换调试

热门文章

  1. Git 分支设计规范
  2. pip安装了包但pycharm里找不到
  3. UI自动化框架搭建
  4. ATTENTION NETWORK分析
  5. Linux高级系统恢复技术
  6. CodeForces 1B 模拟题。
  7. Windows AD日志分析平台WatchAD安装教程
  8. 面型对象和UML类图
  9. 电信IOT平台固件升级
  10. spark集群