- Link to the docs site, returns data with the correct
Content-Typeheader:
curl https://${OWNER}.github.io/${NAME}/${PATH}- Link to the content from the repository. Returns data without
Content-Typeheader:
curl https://raw.githubusercontent.com/${OWNER}/${NAME}/${BRANCH}/${PATH}- Download file from the private repository:
curl https://${TOKEN}@raw.githubusercontent.com/${OWNER}/${NAME}/${BRANCH}/${PATH}- Link to the
LFSrepository content:
curl https://media.githubusercontent.com/media/${OWNER}/${NAME}/${BRANCH}/${PATH}- Download release asset:
curl https://github.com/${OWNER}/${NAME}/releases/download/${TAG}/${FILE_NAME}- Download branch as archive:
curl https://github.com/${OWNER}/${NAME}/archive/${BRANCH}.tar.gz- Download tag as archive:
curl https://github.com/${OWNER}/${NAME}/archive/refs/tags/${TAG}.tar.gzgit remote rm origin
git remote add origin $URL
git push origin --all
git push --tags-
Rename local branch:
git branch -m old new
-
Rename remote branch:
# rename remote branch git push origin :old new # update local branch upstream git branch new -u origin/new
git checkout $(git rev-list -n 1 HEAD -- "$FILE_PATH")^ -- "$FILE_PATH"# files
git clean --force
# directories
git clean --force -dgit reset --hard $SHA1_COMMIT_IDIf changesets were pushed:
git push origin HEAD --forcegit filter-repo --force --partial --invert-paths --path-match $FILE_PATH
git reflog expire --expire-unreachable=now --all
git gc --prune=now --aggressiveMode: XXXYYY
where:
-
XXX:100- regular file120- symlink
-
YYY:644-rw-r--r--755-rwxr-xr-x
# list execulable files
git ls-files --format "%(objectmode) %(path)" | grep "^100755"
# make file in "bin" and "tests" directories executable
git ls-files -z bin tests | xargs -0 git update-index --chmod=+x
# make ".sh" file executable
git ls-files -z *.sh | xargs -0 git update-index --chmod=+x# install
apt install --yes git-crypt
# init
git crypt init
# symmetric key
git crypt export-key secret.git-crypto
git crypt unlock secret.git-crypto
# gpg
git crypt add-gpg-user --trusted $EMAIL
git crypt unlockgit reset --soft $(git rev-list --max-parents=0 HEAD)
git commit -a --amend -m "chore: init"
git push origin HEAD --force
git reflog expire --expire-unreachable=now --all
git gc --prune=now --aggressiveSync other clone with updates:
git fetch --all
git reset --hard origin/main
git reflog expire --expire-unreachable=now --all
git gc --prune=now --aggressive# create remote "upstream"
git remote add upstream --no-mirror git@github.com:${OWNER}/${NAME}.git
# track "main" branch only
git remote set-branches upstream main
# add tracking branch
git remote set-branches --add upstream $BRANCH_NAME-
Current repository:
# sync local "main" branch with the upstream "main" brach gh repo sync # sync local "main" branch with the upstream "feat" branch gh repo sync --branch feat
-
Remote repository:
# sync remote "main" branch with the upstream "feat" branch gh repo sync softvisio/test --branch feat -
Manual sync:
# fetch changes from the upstream git fetch upstream # merge "main" branch with upstream git sw main git merge upstream/main