(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完成。

git在idea中使用的更多相关文章

  1. [转]git在eclipse中的配置

    一_安装EGIT插件 http://download.eclipse.org/egit/updates/ 或者使用Eclipse Marketplace,搜索EGit 二_使用EGIT前的配置 配置个 ...

  2. git在myelispse中的安装

    1.git在myelispse中的安装 http://blog.csdn.net/chinaonlyqiu/article/details/8830050

  3. 【转】git在eclipse中的配置

    原文网址:http://www.cnblogs.com/zhxiaomiao/archive/2013/05/16/3081148.html 一_安装EGIT插件 http://download.ec ...

  4. git 在linux中的使用

    1,经常使用操作 一,clone远程仓库 比如clone test项目的分支v1.0 git -c diff.mnemonicprefix=false -c core.quotepath=false ...

  5. git stash pop 冲突,git stash list 中的记录不会自动删除的解决方法

    在使用git stash代码时,经常会碰到有冲突的情况,一旦出现冲突的话,系统会认为你的stash没有结束. 导致的结果是git stash list 中的列表依然存在,实际上代码已经pop出来了. ...

  6. git在工作中的用法总结-使用篇

    上一篇介绍了git的环境安装配置,本篇对git在工作中常用的用法进行总结,已满足大部分的日常工作需求,对于其他的一些git命令用法在今后使用到时我也会更新上来,文中如有错误,欢迎大家指出来,谢谢~ 一 ...

  7. git上传中的排除的配置文件, git实际的操作代码;

    git上传中的排除的配置文件: git实际的操作 在主目录建立.gitignore文件并输入以下保存: *.class #package file *.war *.ear #kdiff3 ignore ...

  8. 在Git.oschina.net中配置TortoiseGit使用sshkey,无需输入账号和密码

    ssh的方式 git@oschina.com:用户名/版本库t.git           此篇文章针对于这种 黄海正在开发的项目位置 https://gitee.com/dslx/BigData.g ...

  9. Git submodule 仓库中包含另外的仓库(子仓库)

    Git submodule 仓库中包含另外的仓库(子仓库) 添加 submodule 在父仓库 git 目录下: git submodule add ssh://ip/[path]/xxx.git 注 ...

  10. Git 2.x 中git push时遇到 push.default 警告的解决方法

    近在学习使用 git&GitHub,然后今天遇到了一个问题.在执行 git add 和 git commit 操作之后,再进行 git push 操作,出现了如下提示: $ git push ...

随机推荐

  1. Spring ——Spring IoC容器详解(图示)

    1.1 Spring IoC容器 从昨天的例子当中我们已经知道spring IoC容器的作用,它可以容纳我们所开发的各种Bean.并且我们可以从中获取各种发布在Spring IoC容器里的Bean,并 ...

  2. 学习Sparql

    一 . gstore--一种开源图数据库系统 https://www.docin.com/p-1951514687.html 二 . 使用 SPARQL 查询 RDF 数据 https://www.i ...

  3. zabbix-agentd配置文件详解

    agent 端配置文件路径 :/etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pid #<===指定pi ...

  4. CNN目标检测系列算法发展脉络——学习笔记(一):AlexNet

    在咨询了老师的建议后,最近开始着手深入的学习一下目标检测算法,结合这两天所查到的资料和个人的理解,准备大致将CNN目标检测的发展脉络理一理(暂时只讲CNN系列部分,YOLO和SSD,后面会抽空整理). ...

  5. 《python可以这样学》第一章

    一.Python基础 查看Python版本 Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AM ...

  6. get、post请求参数乱码解决方法(qq:1324981084)

    java高级架构师全套vip教学视频,需要的加我qq1324981084 在实际的项目中我们会遇见中文乱码的问题,这个问题是很恶心的事,所以我在这里提供了一些解决中文乱码的方法,希望能给大家一些帮助. ...

  7. RedHat7安装NetCore环境并发布网站

    RedHat7安装NetCore环境并发布网站 1.注册Microsoft签名密钥并添加Microsoft产品提要,每台机器只需注册一次 执行下面的命令即可 rpm -Uvh https://pack ...

  8. Python3标准库:itertools迭代器函数

    1. itertools迭代器函数 itertools包括一组用于处理序列数据集的函数.这个模块提供的函数是受函数式编程语言(如Clojure.Haskell.APL和SML)中类似特性的启发.其目的 ...

  9. idea创建基于maven的web项目

    1.点击create new project,选择maven,点击next 2.输入项目信息,点击finish 3.进入项目后,点击菜单File->Project Structure开始配置项目 ...

  10. 正则表达式验证IP地址(绝对正确)

    正则验证合法_有效的IP地址(ipv4/ipv6) 不墨迹直接上代码: 正则表达式: /^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[ ...