I work on multiple projects during a regular work day - usually 2-4, but could be as many as 8. Each project has a different main Git branch, theme folder, build command to compile said theme, and a couple of other settings (I'm a Drupal developer, so several settings are Drupal-specific, but the concept I'm going to explain can apply to any type of project). Keeping track of each of these as I switch between projects was a pain in the neck, so I came up with an old-school solution.
tl;dr: Create a dot-file in your project root folder that contains the relevant info and display it when you change to that project.
In the olden days of Norton Commander and BBS systems, you could create a file in your directories that contained descriptions for files in that directory. I think the file was named descript.ion
or something like that. Anyway, using that idea, I created a .readme
file in each project's root folder. The file contains a standard structure so that it's easy for me to find the info I need. Here's an example:
Git main branch : dev
Config import : vcs
Drupal version : 8.7.11
Code folder : docroot/profiles/myproject/
Theme folder : docroot/profiles/myproject/themes/myproject_theme
Theme scripts : npm run exec
Don't forget to exclude this file in your .gitignore
file. I guess you could leave it there for other developers in your team, as long as there is nothing sensitive in there - depending on what your root folder is, this file might get exposed at some point.
This alone is pretty handy, but I had to type cat .readme
each time to see this info, and if I can save some typing, I will. Each project already had a bash alias that changes directory to it, so all I did was add cat .readme
to that alias:
alias mp="cd ~/Sites/myproject && ls -al && cat .readme"
The ls
command is helpful to me to know exactly where I am - how many times do you cd into a directory and immediately type ls
?? In fact, I integrated the ls
into the cd
command and removed it from the alias above:
alias l="ls -al"
function cd () {
builtin cd "$1"
l
}
The above aliases go into ~/.bash_profile
or ~/.bashrc
depending on your OS. I only work on Mac and Linux, so I don't know if you can do something similar in Windows' command line.
That's it. Hopefully you find this as useful as I do. If anyone has a different solution let me know in the comments below.
Top comments (0)