https://github.com/krishnamodepalli/gitautopuller
Automate the git pull/fetch from remote when entering a local git repo.
https://github.com/krishnamodepalli/gitautopuller
automation bash git gitautopull
Last synced: 5 months ago
JSON representation
Automate the git pull/fetch from remote when entering a local git repo.
- Host: GitHub
- URL: https://github.com/krishnamodepalli/gitautopuller
- Owner: krishnamodepalli
- Created: 2024-09-02T12:15:58.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-13T16:55:43.000Z (almost 2 years ago)
- Last Synced: 2025-06-16T05:45:11.594Z (about 1 year ago)
- Topics: automation, bash, git, gitautopull
- Language: Shell
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# gitautopuller
This is a simple bash script extension to check if the current directory
is a `git` repository or not and ask the user to either `pull`, `fetch` or
just do nothing.
## Install
We use makefile to install the bash script.
Linux (Debian/Ubuntu):
```bash
sudo make install
```
There is one more thing after installation, you need to setup your shell
to check if the current directory is a git repository or not. For that,
add corresponding script for your shell
#### `bash`
Add the following into your `.bashrc` file.
```bash
PROMPT_COMMAND="fetch_or_pull"
```
#### `zsh`
Add the following into your `.zshrc` file.
```zsh
chpwd() {
fetch_or_pull
}
```
#### `fish`
Unfortunately `fish` do not support this feature of runnning a command on each
directory changes. But we can take advantage of the `cd` command and alias it
with a new function just like below.
```fish
function cd
# call the original `cd` command
command cd $argv
# running our script down here
fetch_or_pull
# you can also run any other scripts down here
end
```
## Uninstall
As simple as install
```bash
sudo make uninstall
```