干啥用我不知道,就是能查到
git config --list
#-s 来获得简短的输出结果
git status
#Git 全局设置
git config --global user.name "吴延博"
git config --global user.email "saowu.gan@qq.com"
#推送现有文件夹
cd existing_folder
git init --initial-branch=main
git remote add origin git@127.0.0.1:wuyanbo/test.git
git add .
git commit -m "Initial commit"
git push -u origin main
commit_id
点创建分支git checout -b <new_branch_name> <commid_id>
#提交修改到暂存区
git add .
#将暂存区内容添加到本地仓库中
git commit -m [message]
#将本地仓库内容推送到远程仓库中
git push
git merge [其他分支]
git log
git blame [文件名]
#-r 列出所有远程分支名称
#-a 列出所有分支名称
git branch -a
checkout
远程仓库的分支#基于origin/release,在本地起名为release分支,并切换到本地的release分支
git checkout -b [分支名] origin/[分支名]
git checkout -b [分支名]
git branch -d 分支名
#拉取全部
git fetch --all
#回滚到与远程仓库一致
git reset --hard origin/分支名
#拉取最新
git pull
查询GITLAB分支创建人
<dependency>
<groupId>org.gitlab4j</groupId>
<artifactId>gitlab4j-api</artifactId>
<version>4.15.7</version>
</dependency>
@Test
public void getCreateBranch() {
Integer projectId = 1617;
String ref = "grey_1210";
GitLabApi client = new GitLabApi("https://git.cn", "GITLAB_TOKEN");
try {
List<Event> projectEvents = client.getEventsApi().getProjectEvents(projectId, Constants.ActionType.PUSHED, null, null, null, Constants.SortOrder.ASC);
Optional<Event> create = projectEvents.stream()
.filter(event -> ref.equals(event.getPushData().getRef()))
.findFirst();
create.ifPresent(event -> {
System.out.println("Ref:" + event.getPushData().getRef());
System.out.println("Action:" + event.getPushData().getAction());
System.out.println("Time:" + DateUtil.FORMAT.format(event.getCreatedAt()));
System.out.println("Author:" + event.getAuthorUsername());
});
} catch (GitLabApiException e) {
throw new BusinessException("查询失败, error:" + e.getMessage());
}
}