Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gjabouley-invn/310b111e749880d62b681c8f7645e77e to your computer and use it in GitHub Desktop.
Save gjabouley-invn/310b111e749880d62b681c8f7645e77e to your computer and use it in GitHub Desktop.
Some usefull git commands
# Create a branch name using short commit sha1, then push on it
BRANCH_NAME=migration/$(git log -1 --pretty=format:%h)_submodule_github
git checkout -b $BRANCH_NAME
git commit -am "[GITHUB MIGRATION] Update submodules urls on protected branches"
git push --set-upstream origin $BRANCH_NAME
# Git lfs migrate
export REPO_URL=<REPO_COMPLETE_URL>
git clone --mirror ${REPO_URL} local_folder && pushd local_folder && git lfs fetch --all && git lfs migrate --everything info
git lfs migrate import --everything --verbose --object-map=../mapping_file.map.txt --include="<PATTERNS>" (ex: *.apk,*.png)
sed -i 's/,/ /g' ../mapping_file.map.txt && git reflog expire --expire-unreachable=now --all && git gc --prune=now --aggressive
git lfs push origin --all && git push -f origin --mirror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment