My projects on GitHub: https://ruzickap.github.io
https://profile-summary-for-github.com/user/ruzickap
GitHub's official command-line tool (gh
): https://cli.github.com/
GITHUB_REPO_TO_CONTRIBUTE="https://github.com/oxsecurity/megalinter"
BRANCH_NAME="improve-tflint-docs"
# fork and clone GitHub repository
gh repo fork --clone --remote ${GITHUB_REPO_TO_CONTRIBUTE}
cd "$(basename \"${GITHUB_REPO_TO_CONTRIBUTE}\")" || exit
# create new branch
git checkout -b "${BRANCH_NAME}"
# Do the changes
git add my_changed_file && git commit -m "done with feature"
# push the changes to your new remote (https://github.com/cli/cli/issues/546)
git push origin "${BRANCH_NAME}"
# open a pull request for the topic branch you've just pushed
gh pr create --web --fill
# once PR is merged then remove the branch
git checkout main
git pull -r
git branch -D "${BRANCH_NAME}"
# clone GitHub repository
git clone git@github.com:ruzickap/packer-templates.git
cd packer-templates || exit
# create new branch
git checkout -b "my_new_branch"
# do the changes
git add my_changed_file && git commit -m "done with feature"
# open a pull request for the topic branch you've just pushed
gh pr create --web --fill
# Squash and Merge
# once PR is merged then remove the branch
git checkout main
git pull -r
git branch -D my_new_branch
Check: https://codewithhugo.com/fix-git-failed-to-push-updates-were-rejected/)
git fetch
git rebase main
git mergetool
git rebase --continue
or ...
git checkout main
git pull -r && git submodule update --init
git checkout feature/improve_documentation
git rebase main
git status
vim docs/test.rst
# do the changes
git add docs/test.rst
git rebase --continue
git push -f ruzickap feature/improve_documentation
git add some_file
git commit -m 'Squash this' && git rebase -i HEAD~2 && git push -f
# in your editor put "f" in front of the commit you want to squash
git submodule update --init --recursive
Check tags:
git for-each-ref --format="%(refname:short) | %(subject)" refs/tags | column -t
Output:
v1 | Release v1.0.0
v1.0.0 | Release 1.0.0
Delete v1
tag:
git push --delete origin v1
git tag -d v1
Create release:
release-it
or
git tag v3.0.6
git push --tags
git push origin :refs/tags/my-tag-name
git tag -d my-tag-name
git log
git rebase -i 'd0efb718512fe78475056c5370884ca53f5df82b^'
reword d0efb71 test commit
my new commit
git push --force
git tag -a new old^{}
git tag -d old
git push origin :refs/tags/old
git push --tags
git status
git add .github/workflows/commitlint.yml .github/workflows/stale.yml
git checkout -b stale
git commit -m "feat(gh_actions): replace stale + add commitlint"
git push
gh pr create --web --fill
git checkout main
git branch -D stale
git pull -r
find ~/git/ -maxdepth 4 -path "*/.github/workflows/*.yml" -type f -exec awk -F' uses: ' '/^\s*uses: \w/ || /^\s*- uses: \w/ { print " - uses: " $2 }' {} \; | sort | uniq