git使用命令
git init 初始化
git remote add origin git@code.data4truth.com:dataplatform/dataLake.git 添加远程关联
git remote add shb git@code.data4truth.com:sanhongbo/realtime-etl-yanglao.git 添加分支远程关联
git remote rename origin shb 将拉下来的分支改名
git remote -v 查看本地所有的remote
git branch -a 查看所有版本
git branch -d master_bk 删除分区
git status 查看状态
git add 将内容添加到暂存区
git fetch origin 从远程仓库拉取
git rebase origin/master(git rebase origin/dev) merge
git push shb :test 删除远程分支
git log
git push shb master 提交代码
git restore --staged 将暂存区文件撤销回来
git checkout – 回退上版本 (上次commit后工作区的状态)
git rm -r –cached .
删除本地提交
创建新项目的情况下 fork一下,在本地建立和分支的关联。提交代码时先
git remote add origin git@code.data4truth.com:dataplatform/realtime-etl-yanglao.git 添加远程关联
git remote add shb git@code.data4truth.com:sanhongbo/realtime-etl-yanglao.git 添加分支远程关联
git fetch origin 拉取代码
git add .
git commit -a
git rebase origin/master
git push shb master--
解决冲突
git commit -a.
git fetch origin
git merge origin/dev
再add 提交
提交代码时去除无用文件,创建.gitignore文件在项目目录下
./target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
*.class
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
# Project
classes/
target/
class/
intelligent/target/
.idea/
*.iml
.class
stream/src/main/java/com/d4t/dataplatform/connect/dynamic/*
*.jar
dependency-reduced-pom.xml
out/