git初始化

2017-05-25  本文已影响0人  alexbo

1.登录码云

2.点右上角的加号,新建项目

3.复制项目:https://git.oschina.net/study2427660242/project_name.git

回到idea,初始化git

在终端里面执行:alex@alex-pc ~/IdeaProjects/mmall $ touch README.md

alex@alex-pc ~/IdeaProjects/mmall $ touch .gitignore

配置.gitignore

*.class

#package file

*.war

*.ear

#*.jar

#kdiff3 ignore

*.orig

#maven ignore

target/

#eclipse ignore

.settings/

.project

.classpath

#idea ignore

.idea/

/idea/

*.ipr

*.iml

*.iws

#temp file

*.log

*.cache

*.diff

*.patch

*.tmp

#system ignore

.DS_Store

Thumbs.db

整体命令:

touch README.md

touch .gitignore

git init

git status

git add .

git stutas

git commit -am 'first commit init project'(am后面是注释)

git remote add origin  https://git.oschina.net/study2427660242/project_name.git(连接远程仓库)

git push -u origin master(提交到远程仓库)

git pull

git push -u -f origin master(强行提交到远程仓库,覆盖远程的新建的master)

git checkout -b v1.0 origin/master(check v1.0的本地分支)

git push origin HEAD -u (提交本地分支到远程仓库)

其他命令:

find . -name ".git" | xargs rm -Rf(删除本地git仓库)

git branch(查看本地分支)

git branch -r(查看远程分支)

解决反复输入用户和密码的方法

编辑vim ~/.gitconfig

加上[credential]

helper = store

上一篇 下一篇

猜你喜欢

热点阅读