git flow
参考
常用git操作
常用git命令
git clone --depth 1 --branch aliyun_openai_dev_iam git@code.alipay.com:data_release/ai-studio.git
git pull origin master --allow-unrelated-histories
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -5 | awk '{print$1}')"
git filter-branch -f --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch app/common/service/fg/src/main/resources/linux-x86-64/_external.tar.gz' --tag-name-filter cat -- --all
git remote set-url origin git@code.alipay.com:antcloud-openai/aistudio.git
git push origin aliyun_openai_dev:master
git rebase -i [startpoint] [endpoint]
git reset
git reset --soft 可以保留更改到本地workspace ,然后重新commit,可以将多个commit合并成一个,然后提交到远端。
git reset --hard origin/xxx
git push -f
git reflog
git reflog后查看hash值
git reset $hash 可以切换到指定的步骤
git 创建空分支
git checkout --orphan emptybranch
git rm -rf .
echo '# new branch' >> README.md
git add README.md
git commit -m 'new branch'
git push origin emptybranch
git 同步另外一个远程仓库的分支
#!/bin/bash
other_repo=$1
source_branch=$2
target_branch=$3
git remote add other-remote $other_repo
git fetch other-remote
git checkout -b $target_branch
git reset --hard other-remote/$source_branch
git push origin $target_branch
git remote remove other-remote
git 忽略远端主机证书异常
ssh-keyscan gitlab.alipay-inc.com >> ~/.ssh/known_hosts
ssh -T git@gitlab.alipay-inc.com