You are not logged in.
I have all my files in two Git repositories: one for code and the other for personal documents. However I often forget to check which branch I'm on and so end up not commiting very cleanly. Is there some way I can have a 'git branch' run whenever I cd into my repository directories? (the top levels at least)
The Bytebaker -- Computer science is not a science and it's not about computers
Check out my open source software at Github
Offline
Probably the most pragmatic solution to that question would be to have cd be an alias to a script you write that calls cd and then does the appropriate action depending on the value of pwd.
In addition, you might want to rethink how you're using git. Basically, I find that the more often I run git status the better. :-D
Finally, if you have a messy commit, you can use various combinations of git rebase, git cherry-pick, git reflog, git reset (hard, soft and mixed can all be useful) and git revert to get yourself back to a more sane situation. Make sure to study those man pages.
Dusty
Offline
I'd rather use shell function, 'cd' may be hard to implement as a shell script. Besides, there is one more possibility (in bash; don't know about other shells) -- PROMPT_COMMAND environment variable; something like:
[briest@kreml ~]$ cdfun() { if [ "$DUPA" != "$PWD" ] ; then echo "You have entered $PWD"; DUPA="$PWD"; fi; }
[briest@kreml ~]$ export PROMPT_COMMAND=cdfun
Last edited by briest (2009-02-06 19:11:44)
Offline
In addition, you might want to rethink how you're using git. Basically, I find that the more often I run git status the better. :-D
+1
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline