Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
## Make Commands Available from Path

```vim ~/.bash_profile```

```export PATH=$PATH:/var/www/git-refresh```

## Show All Available Commands

```git mycommands```

All commands are namespaced with "my" in order to prevent conflicts with built-in git commands.

## Index

1. [git-refresh](#git-refresh) - Refresh current local branch with any remote branch easily.
2. [git-pushremote](#git-pushremote) - Push local branch changes to remote branch after updating from it.
3. [git-switch](#git-switch) - Switch branches easily. Takes care of stashing changes and creating a new branch if required.
Copy link
Owner

@shobhitpuri shobhitpuri Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natesire Sorry, somehow missed the PR. Can you please remove the above 3 lines, since they are already included in the changes below?


1. [git-mybranchsort](#git-mybranchsort) - Sort branches by date
2. [git-mycommands](#git-mycommands) - List all available custom commands
3. [git-mylatestchanges](#git-mylatestchanges)
4. [git-mypullallremote](#git-mypullallremote) - Pull all remote branches
5. [git-mypush](#git-mypush) - Add and push all files
6. [git-mypushremote](#git-mypushremote)
7. [git-myrefresh](#git-myrefresh) - Push local branch changes to remote branch after updating from it.
8. [git-myreset](#git-myreset)
9. [git-mystash](#git-mystash)
10. [git-mystashdrop](#git-mystashdrop)
11. [git-mystashshow](#git-mystashshow)
12. [git-mysubmodules](#git-mylistsubmodules)
13. [git-myswitch](#git-myswitch) - Apply stash to a new branch

3. [Setup Cutom Commands](#setup) - Get started in 5 minutes max.
4. [Creating Custom Git Commands](#writing-custom-git-commands) - Have your own ideas? Create custom scripts.

Expand Down
6 changes: 6 additions & 0 deletions git-mybranchsort
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# branches
# sort branches by date updated
git branch --sort=committerdate

4 changes: 4 additions & 0 deletions git-mycommands
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

# show all custom commands
ls | grep git
4 changes: 4 additions & 0 deletions git-mylatestchanges
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

# show files changed
git show --name-only $1
5 changes: 5 additions & 0 deletions git-mypullall
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done
git fetch --all
git pull --all
7 changes: 7 additions & 0 deletions git-mypush
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

git add .
git commit -a -m "$1"
git push


File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions git-myreset
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

git stash save --keep-index --include-untracked
5 changes: 5 additions & 0 deletions git-mystash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

# git stash list
git stash list

5 changes: 5 additions & 0 deletions git-mystashdrop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

# git stash drop
git stash drop

5 changes: 5 additions & 0 deletions git-mystashshow
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

# does a diff
git stash show -p

4 changes: 4 additions & 0 deletions git-mysubmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

# list submodules
git config --list|egrep ^submodule
File renamed without changes.