We all work with git repositories once we start learning programming and coding. When we use git a lot and starting to get used to it, someday we will encounter the problem of committing new changes locally and pushing when we have some changes to pull, in the first place, which we did forget.
Some IDE's like jetbrains (and vscode maybe) provide you the feature to pull any recent changes to the repository in the remote, Which will save us from this problem. But fate is too harsh on us sometimes, we can do nothing but revert the code and just re-commit our changes.
So I did want to come up with a solution which is simple and easy to set-up. So what I did is, when ever I enter a git repo (local git repo folder), I will run a simple bash script which will ask the user to either pull
, fetch
or just do nothing.
The script is very simple, please check my github repo for this simple bash automation project.
Currently I am trying to give it a bit more flavour. The bash script is sometimes very annoying, if we frequently move between projects. So I want to implement a time barrier, which checks the last time I opened this project. If it is more than 20 mins, then the script will ask to fetch new changes. Other-wise, the script silently continues to exit.
Top comments (0)