Skip to content

Commit 1ce55fb

Browse files
authored
Merge pull request #10 from xnivaxhzne/master
Master -> Production
2 parents eab43f3 + a97ae96 commit 1ce55fb

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ npm i -g @xniva/git-shortcuts
3232
| `glc` | `git show-branch --no-name HEAD` | Copy and Print the last commit message |
3333
| `gsf` | `gcm && gpm && git merge --no-commit --no-ff origin/${featureBranch}` | List the changes of a feature branch w.r.t master - for review |
3434
| `gma` | `git merge --abort` | Abort the merge |
35+
| `grb` | `git reset --${hardOrSoft} origin/$(git rev-parse --abbrev-ref HEAD)` | Reset the current branch to its remote equivalent |
3536

3637
### Master branch name is configurable:
3738

bin/git_reset_current_branch.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#! /usr/bin/env node
2+
import main from "./../lib/git_reset_current_branch/index.js";
3+
4+
main();

lib/git_reset_current_branch/index.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import runCommand from "./../utils/run_command.js";
2+
3+
const main = () => {
4+
let isHard = process.argv[2] === "--hard" || process.argv[2] === "-h";
5+
6+
const hardOrSoft = isHard ? "hard" : "soft";
7+
8+
runCommand(
9+
`git reset --${hardOrSoft} origin/$(git rev-parse --abbrev-ref HEAD)`
10+
);
11+
};
12+
13+
export default main;

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@xniva/git-shortcuts",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"description": "Shortcuts for the commonly used git commands",
55
"repository": "https://github.com/kavinkuma6/git-shortcuts",
66
"bin": {
@@ -18,7 +18,8 @@
1818
"glc": "bin/git_print_copy_last_commit_message.js",
1919
"gr": "bin/git_restore.js",
2020
"gsf": "bin/git_see_feature_files.js",
21-
"gma": "bin/git_merge_abort.js"
21+
"gma": "bin/git_merge_abort.js",
22+
"grb": "bin/git_reset_current_branch.js"
2223
},
2324
"author": "Kavinkumar R",
2425
"license": "MIT",

0 commit comments

Comments
 (0)