👋 Errors, improvements or other cool stuff? Let me know! 😀
git clone [email protected]:xxx/xxx.git dst_dir
git init
git remote add origin [email protected]:xxx/xxx.git
git pull origin master
git branch --set-upstream-to=origin/master master
git remote -v # Show remote URLs (fetch & push)
# Or: git remote get-url origin
git remote set-url origin [email protected]:xxx/xxx.git
git remote -v
git describe --tags --abbrev=0
git fetch origin && git reset --hard origin/main
git rm --cached path/to/file
git rm --cached 'path/to/*' # Or "*" must be escaped: path/to/\*
See: https://confusatory.org/post/133141617492/git-diff-for-binary-apple-property-list-files
Local:
git config diff.plist.textconv 'plutil -convert xml1 -o -'
echo '*.plist diff=plist' >> .gitattributes
Global:
git config --global diff.plist.textconv 'plutil -convert xml1 -o -'
git config --global core.attributesfile $HOME/.gitattributes
echo '*.plist diff=plist' >> $HOME/.gitattributes
newVersion="0.2.0"
oldVersion=$(cat VERSION)
oldVersion=$(grep -oP "@version \K.+$" file) # If your grep works with Perl regex.
oldVersion=$(grep -E -m 1 "@version (.+)$" file | sed -E "s/^.+@version (.+)$/\1/")
grep -rl "${oldVersion//./\\.}" . | xargs sed -i "" -e "s/${oldVersion//./\\.}/${newVersion//./\\.}/g"
Update CHANGELOG.md
git add VERSION CHANGELOG.md
git commit -m "Short description of changes.\n\nMore details…"
git tag -a "${newVersion}" -m "Bump version: $oldVersion → $newVersion"
git push origin master
git push origin "${newVersion}"
- (optional) To keep the changes associated with the detached HEAD:
git branch tmp
- Activate (point
HEAD
at) themain
branch:git checkout main
- (optional) To incorporate the changes into
main
:git merge tmp