-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add aliases for topic-start and topic-finish
- Loading branch information
1 parent
3654409
commit 80a6c79
Showing
8 changed files
with
145 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
index.md |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# git topic-finish | ||
|
||
## Finish the current topic branch | ||
|
||
Git alias: | ||
|
||
```git | ||
topic-finish = "!f(){ \ | ||
new_branch=$(git current-branch); \ | ||
old_branch=$(git topic-base-branch); \ | ||
if [ \"$new_branch\" = \"$old_branch\" ]; then \ | ||
printf \"You are asking to do git topic-end,\n\"; \ | ||
printf \"but you are not on a new topic branch;\n\"; \ | ||
printf \"you are on the base topic branch: $old_branch.\n\"; \ | ||
printf \"Please checkout the topic branch that you want,\n\"; \ | ||
printf \"then retry the git topic-end command.\n\"; \ | ||
else \ | ||
git push; \ | ||
git checkout \"$old_branch\"; \ | ||
git branch --delete \"$new_branch\"; \ | ||
git push origin \":$new_branch\"; \ | ||
fi; \ | ||
};f" | ||
``` | ||
|
||
Example: | ||
|
||
```shell | ||
git topic-finish | ||
``` | ||
|
||
This alias comes in two flavors for your preference: | ||
|
||
* topic-finish | ||
* topic-end | ||
|
||
Customize this alias as you like for your own workflow. | ||
|
||
This must be the current branch. | ||
|
||
We use this alias to complete work on a new feature, | ||
new task, new fix, new refactor, new optimization, etc. | ||
|
||
Our workflow does these steps: | ||
|
||
1. Push the topic branch. | ||
|
||
2. Delete the topic branch locally. | ||
|
||
3. Delete the topic branch remotely. | ||
|
||
If you use a sharing site such a GitHub, and use typical settings, | ||
then this implementation deletes your branch for the site. | ||
|
||
Many teams choose to delete topic branches when they are finished, | ||
to keep the repositories clean and with a smaller number of branches. | ||
|
||
If git says "unable to push to unqualified destination" then it means | ||
that the remote branch doesn't exist, so git is unable to delete it; | ||
that message is typically ok because it means that someone else has | ||
already deleted the branch. To synchronize your branch list, you can | ||
use "git fetch --prune". |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
index.md |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# git topic-start | ||
|
||
## Start a new topic branch | ||
|
||
Git alias: | ||
|
||
```git | ||
topic-start = "!f(){ \ | ||
new_branch=\"$1\"; \ | ||
old_branch=$(git topic-base-branch); \ | ||
git checkout \"$old_branch\"; git pull; \ | ||
git checkout -b \"$new_branch\" \"$old_branch\"; \ | ||
git push --set-upstream origin \"$new_branch\"; \ | ||
};f" | ||
``` | ||
|
||
Example: | ||
|
||
```shell | ||
git topic-start add-feature-foo | ||
``` | ||
|
||
This alias comes in two flavors for your preference: | ||
|
||
* topic-start | ||
* topic-begin | ||
|
||
Customize this alias as you like for your own workflow. | ||
|
||
We use this alias to begin work on a new feature, | ||
new task, new fix, new refactor, new optimization, etc. | ||
|
||
Our workflow does these steps: | ||
|
||
1. Update the base topic branch. | ||
|
||
2. Create a new topic branch based on the topic base branch name, | ||
|
||
3. Push the new topic branch, so team members can see it. | ||
|
||
If you use a sharing site such a GitHub, and use typical settings, | ||
then this implementation makes your branch visible to collaborators. | ||
|
||
Many teams share branches before they are fully ready, to help | ||
the team provide feedback on the work-in-progress, and also to | ||
run any automatic tests to verify the branch runs successfully. |
This file contains 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