Last active
June 3, 2016 18:22
-
-
Save bindul/f8b4417a57c1fbfa2346 to your computer and use it in GitHub Desktop.
Useful URLs and scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use GNOME keyring https://byteplumbing.net/2014/12/secure-storage-for-http-basic-auth-credentials-with-git/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Credit: Jason Van Zyl on org.apache.maven.dev (http://markmail.org/message/ayg5xqeevixpe2iz) | |
For a given PR with a URL of, say, https://github.com/apache/maven/pull/67 | |
wget https://github.com/apache/maven/pull/67.patch | |
git apply —stat 67.patch | |
This allows you to see what changes will be made. | |
git apply —check 67.patch | |
This let’s you see if there are any issues. | |
git am —signoff < 67.patch | |
Show’s that you, the Maven committer applying the patch on behalf of someone | |
else, has signed off on the patch. | |
git commend —amend | |
Here I added a line to the commit to close the issue on Github | |
<existing commit message> | |
closes #67 | |
Then I run the tests and if all is good I | |
git push |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A Git pre-push script, that prevents pushing 00_wip/* branches to GitHub (or any remote). | |
# | |
# See https://git-scm.com/docs/githooks | |
# See https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample | |
# | |
# Save as <git_clone>/.git/hooks/pre-push | |
# | |
# This hook is called by git push and can be used to prevent a push from taking place. The hook is called with two | |
# parameters which provide the name and location of the destination remote, if a named remote is not being used both | |
# values will be the same. | |
# Information about what is to be pushed is provided on the hook’s standard input with lines of the form: | |
# <local ref> SP <local sha1> SP <remote ref> SP <remote sha1> LF | |
# For instance, if the command git push origin master:foreign were run the hook would receive a line like the following: | |
# refs/heads/master 67890 refs/heads/foreign 12345 | |
# although the full, 40-character SHA-1s would be supplied. If the foreign ref does not yet exist the <remote SHA-1> | |
# will be 40 0. If a ref is to be deleted, the <local ref> will be supplied as (delete) and the <local SHA-1> will be | |
# 40 0. If the local commit was specified by something other than a name which could be expanded (such as HEAD~, or a | |
# SHA-1) it will be supplied as it was originally given. | |
# If this hook exits with a non-zero status, git push will abort without pushing anything. Information about why the | |
# push is rejected may be sent to the user by writing to standard error. | |
remote="$1" | |
url="$2" | |
wip_branch='00_wip' | |
wip_branch_regex='^.*'$wip_branch'.*$' | |
policy='[Policy] Never push the WIP (Work In Progress) branches with the format '$wip_branch' in the branch name! (Prevented with pre-push hook.)' | |
z40=0000000000000000000000000000000000000000 | |
IFS=' ' | |
do_exit(){ | |
echo $policy | |
exit 1 | |
} | |
while read local_ref local_sha remote_ref remote_sha | |
do | |
if [[ $local_ref =~ $wip_branch_regex ]] | |
then | |
do_exit | |
fi | |
done | |
unset do_exit | |
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
you should be able to rebase this pull request by following these steps (some may already be done): | |
* `git remote add upstream <https://github.com/user/repo.git>` | |
* `git checkout master` | |
* `git pull --rebase upstream` | |
* `git checkout <pr branch>` | |
* `git rebase master` | |
* edit/resolve conflicts | |
* `git rebase --continue` | |
* `git push -f` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment