https://github.com/declancm/git-scripts
Bash shell scripts to make life easier when using Git.
https://github.com/declancm/git-scripts
bash git github neovim script vim
Last synced: 11 months ago
JSON representation
Bash shell scripts to make life easier when using Git.
- Host: GitHub
- URL: https://github.com/declancm/git-scripts
- Owner: declancm
- Created: 2021-12-06T03:27:30.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-02T02:18:25.000Z (almost 4 years ago)
- Last Synced: 2025-01-18T08:44:49.413Z (about 1 year ago)
- Topics: bash, git, github, neovim, script, vim
- Language: Shell
- Homepage:
- Size: 62.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# git-scripts
Bash shell scripts to make life easier when using Git.
The scripts allow for:
- automated git commit and push,
- automated git pull.
## The Scripts
### commit.sh
- The script detects the current git repository, the current branch and the name\
of the remote repository, then pushes to the remote repository with the branch\
of the same name.
### commit-silent.sh
- A silent version of 'commit.sh' which only gives an output if an error occurs.
### pull.sh
- Git pull from your remote repository for your current branch.
### pull-silent.sh
- A silent version of 'pull.sh' which only gives an output if an error occurs.
## Dependencies
- Bash
- git
## Installation
1. Clone the directory:
```Bash
git clone https://github.com/declancm/git-scripts.git ~/git-scripts
```
2. Ensure the scripts executable:
```Bash
chmod +x ~/git-scripts/*.sh
```
3. Make sure you have added a remote repository to your desired git directory:
4. Aliases can be created within ' ~/.bashrc ' (or ' ~/.zshrc ' for ZSH as long as\
bash is installed) like so:
```Bash
alias commit='source ~/git-scripts/commit.sh'
alias pull='source ~/git-scripts/pull.sh'
```
## Instructions
### For Terminal Usage
From terminal, manually run the shell scripts:
```Bash
source ~/git-scripts/commit.sh
source ~/git-scripts/pull.sh
```
A string can be supplied as an argument to create a custom commit message.
```Bash
source ~/git-scripts/commit.sh "example commit message"
source ~/git-scripts/pull.sh "example commit message"
```
To get the most benefit from these scripts, create an alias in your .bashrc (or\
.zshrc etc.)
### For Vim/Neovim
The same scripts can be used for vim/neovim:
```vim
nnoremap gc :!source ~/git-scripts/commit.sh
nnoremap gp :!source ~/git-scripts/pull.sh
```