-
Notifications
You must be signed in to change notification settings - Fork 122
Expand file tree
/
Copy pathgitflow.sh
More file actions
executable file
·53 lines (41 loc) · 1.39 KB
/
gitflow.sh
File metadata and controls
executable file
·53 lines (41 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# Prompt for GitHub username
read -p "Enter your GitHub username: " GITHUB_USER
# Clone the forked repository
echo "Cloning forked repository..."
git clone git@github.com:$GITHUB_USER/getnighthawk.git
cd getnighthawk || { echo "Failed to enter repo directory"; exit 1; }
# Add upstream remote
echo "Adding upstream remote..."
git remote add upstream https://github.com/layer5io/getnighthawk.git
# Verify remotes
echo "Verifying remotes..."
git remote -v
# Fetch upstream
echo "Fetching upstream..."
git fetch upstream
# Show branches
echo "Listing branches..."
git branch -va
# Checkout master and merge upstream
echo "Updating local master branch..."
git checkout master
git merge upstream/master
# Prompt for branch type and name
echo "Creating a new branch for your work..."
read -p "Enter branch type (feature/bug): " BRANCH_TYPE
read -p "Enter issue number or short name: " BRANCH_NAME
NEW_BRANCH="$BRANCH_TYPE/$GITHUB_USER/$BRANCH_NAME"
git checkout master
git branch "$NEW_BRANCH"
git checkout "$NEW_BRANCH"
echo "You are now on branch: $NEW_BRANCH"
echo "Make your changes, commit, and push when ready."
# Instructions for rebasing before PR
echo "When ready to submit a PR, run:"
echo " git fetch upstream"
echo " git checkout master"
echo " git merge upstream/master"
echo " git checkout $NEW_BRANCH"
echo " git rebase master"
echo "Optionally squash commits with: git rebase -i master"