Skip to content

Instantly share code, notes, and snippets.

View mohanarpit's full-sized avatar

Arpit Mohan mohanarpit

View GitHub Profile
@mohanarpit
mohanarpit / update-github-prs.sh
Created October 12, 2021 15:19
This script merges the default branch into any PR branch
#!/bin/bash
$default_branch="release"
git checkout $default_branch;
git pull;
while IFS= read -r prs || [ -n "$prs" ]; do
echo "Checking out PR: $prs"
gh pr checkout $prs;
git merge $default_branch --no-edit;
@mohanarpit
mohanarpit / bling.js
Created March 12, 2016 10:16 — forked from KittyGiraudel/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype;
@mohanarpit
mohanarpit / git_migrate_repo.sh
Created May 31, 2013 14:21
This script migrates the local repository from an old remote origin to a new origin. Handy if you're migrating your repository from one service provider to another.
#!/bin/bash
echo "Input the path of the local repository: "
read localPath
echo "Input the URL of the new remote repo: "
read newRemote
cd $localPath
#Get the current remote repo
@mohanarpit
mohanarpit / create_new_db_user.sh
Created May 30, 2013 04:27
This script creates a new database and a user. Useful when setting up a project.
#!/bin/bash
#This script creates a new DB and an associated user with it
echo "Input the database to be created: "
read db
echo "Input the username to be associated with the DB: "
read username
@mohanarpit
mohanarpit / git-truncate-tree
Created May 29, 2013 10:41
This script takes the SHA1-ID of the commit as the input and truncates the history of the repository for all commits beyond that SHA1-ID
#!/bin/bash
# This script takes the SHA-I1D of the commit as the input and truncates the history of the repository for all commits beyond # that SHA1-ID
git checkout --orphan tmp $1
git commit -m "Truncated history"
git rebase --onto tmp $1 master
git branch -D tmp
@mohanarpit
mohanarpit / change-author.sh
Created December 6, 2012 11:26
Script to modify the author and commiter name & e-mail ID in the GIT tree
#!/bin/sh
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "<Old commit name>" ];
then
GIT_COMMITTER_NAME= "<New commit name>";
GIT_AUTHOR_NAME="<New author name>";
GIT_COMMITTER_EMAIL="<New commit email>";
GIT_AUTHOR_EMAIL="<New author email>";
git commit-tree "$@";
else