git使用记录

gitignore文件不生效

// 清除缓存文件
git rm -r --cached .
git add .
git commit -m ".gitignore重写缓存成功"
git push

git rm -r --cached . 若出现一下问题

error: the following file has staged content different from both the
file and the HEAD:
    src/test/java/testWork/TestWork.java
(use -f to force removal)
// 清除掉对应缓存
git rm -r -f --cache src/test/java/testWork/TestWork.java

gitlab替换master

  1. 去除master为默认分支,在项目-仓库-默认分支中设置
  2. 执行 git branch -D master 与 git push origin :master ,删除主分支并推送到远端仓库。
  3. 在想要变成新主分支的分支上创建新分支,并命名为master分支,push到远端仓库。
    git checkout -b master
    git push -u origin master
  4. gitlab中设置新master为 默认分支。

    思路就是解除原master的默认配置并将其删除,创建新master设置成默认

初始化git仓库,抹除commit记录

方法一
1. 删除所有的历史(请确保你有备份,此操作不可逆)
rm -rf .git/
2. 基于当前的内容重建 Git 仓库
git init
git add .
git commit -m "Initial commit"
3. 推送到 Gitlab
git remote add origin <gitlab-uri>
git push -u --force origin master

其它

去除 dependency-reduced-pom.xml 文件,打包时自动生成的。

<configuration>
 <createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <configuration>
          <createDependencyReducedPom>false</createDependencyReducedPom>
        </configuration>
        <executions>
          <!-- Exclude all flink-dist files and only include flink-table-* -->
          <execution>
            <id>shade-plugin</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <artifactSet>
                <includes combine.children="append">
                  <!--Sql parser is included in planners-->
                  <include>*:*</include>
                </includes>
              </artifactSet>
            </configuration>
          </execution>
        </executions>
      </plugin>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值