Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git scripts #7

Open
NullVoxPopuli opened this issue Jul 31, 2017 · 0 comments
Open

Git scripts #7

NullVoxPopuli opened this issue Jul 31, 2017 · 0 comments

Comments

@NullVoxPopuli
Copy link
Owner

NullVoxPopuli commented Jul 31, 2017

most recent git branches

git for-each-ref \
  --sort=committerdate refs/heads/ \
  --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'

"stat" since "time"

 git diff $(git rev-list -n1 --before="2 months ago" main) --shortstat
automated git rebase (needs testing)
#!/bin/bash
set -e

Color_Off='\033[0m'
Yellow='\033[0;33m'

target=${1:-master}
branch=$(git describe --contains --all HEAD)

if [[ "$target" == *"$branch"* ]]; then
  echo -e "${Yellow}Your current branch is the target branch. Aborting.${Color_Off}"
  exit 1;
fi

echo ""
echo -e "${Yellow}Rebasing $branch on top of $target${Color_Off}"
echo ""

echo -e "${Yellow}Updating Origin...${Color_Off}"
git fetch origin

echo -e "${Yellow}Updating $target Branch...${Color_Off}"
git checkout $target
git reset origin/$target --hard

echo -e "${Yellow}Rebasing...${Color_Off}"
git checkout $branch
git rebase $target
@NullVoxPopuli NullVoxPopuli changed the title make script for git stat against time Git scripts Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant