Congratulations! You just won millions of dollars in the lottery! That's great.
Now you're fucked.
No really.
You are.
Congratulations! You just won millions of dollars in the lottery! That's great.
Now you're fucked.
No really.
You are.
# shortform git commands | |
alias g='git' | |
# change author of all git repos | |
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='yourname'; GIT_AUTHOR_EMAIL='youremail@example.com'; GIT_COMMITTER_NAME='yourname'; GIT_COMMITTER_EMAIL='youremail@example.com';" HEAD; | |
# stage only deleted files | |
git ls-files --deleted | xargs git add | |
# scan repo for dangerous Amazon Web Service IDs |
After backing up all my gists and cloning all my starred repositories there is one more thing I want to accomplish: backup
my Github repositories, and by that I really mean the ones I manage and have commit rights to. I could do this by cloning
and periodically pulling (as we discussed here), but you might have noticed that I explicitly exclude my own repositories
in that script by checking for repo.owner.login
. The reason is: I want to mirror them into Gitea.
Why Gitea? Untypically, I’d like a Web UI onto these repositories in addition to the files in the file system. It could have been Gitlab, but I think Gitea is probably the option with the lowest resource requirements.
When I add a repository to Gitea and specify I want it to be mirrored, Gitea will take charge of periodically querying the source repository and pulling changes in it. I’ve mentioned Gitea previously, and I find it’s improving as it matures.
pipeline { | |
environment { | |
DOCKER_REGISTRY = 'https://my-docker-registry.example.com' | |
DOCKER_CREDS = credentials( 'my-docker-credentials' ) | |
} | |
} |
#!/bin/bash | |
set -e | |
# First argument: Client identifier | |
if [ "$#" -ne 1 ] ; then | |
echo "Must pass exactly 1 parameter, not ${#}" | |
exit 2 | |
fi |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
I hereby claim:
To claim this, I am signing this object:
version: '3.1' | |
services: | |
memcached: | |
image: memcached:alpine | |
container_name: kirby-memcached | |
mailhog: | |
image: mailhog/mailhog:latest |
Use:
git branch | grep '<somepattern>'
To select the branches you want to delete. <somepattern> can be a regex or just a text match.
Once you have the list you want, you can use xargs to execute the git command to remove those branches.
Example: Remove all of my branches from the origin: