(targeted audiences: developers/coders/programmers)
Git projects are typically small and we may have multiple projects on a workspace.
Hence sometimes we have 8+ projects on the workspace it may be tedious to update git pull manually. And we don’t have “parent project” like in SVN anymore, not update all option huh? Okay we can do it with shell script.
I’ll make it one-liner, given the current working directory is the workspace:
for i in */.git; do ( echo $i; cd $i/..; git pull; ); done
And when we need to Git pull with rebase (or the global config always rebase when pulling), just use stash along with it. Replace the normal git pull with following:
git stash && git pull --rebase || git pull --rebase && git stash pop
Combined with the command above we can still have “one-liner” , but I also made a simple bash script git-pull-all.sh for arbitrary workspace dir (not just basedir).
For non-Linux user (Redmond), either use Git Bash with above script, or the following batch script counterpart:
for /d %a in (*.*) do cd "%CD%\%a" && git pull
The git rebase stash above still works with Windows.
for /d %a in (*.*) do (cd "%CD%\%a" && git stash && git pull --rebase || git pull --rebase && git stash pop)
I also made a git-pull-all.bat for that as well (using %% variables with for loop, not % as in direct command line).
Bonus: For IDE you may want to enable auto import Maven/Gradle changes (so that after updating Git repos the dependencies will be update automatically). For example IntelliJ IDEA can enable Auto Maven Imports at:
File -> Settings -> Build, Execution, Deployment > Build Tools > Maven > Importing
(old versions of IntelliJ IDEA:
File -> Settings -> Maven > Importing
Also, enable Annotation Processing will be good when you are using libraries such as Lombok or Mapstruct.
File -> Settings -> Build, Execution, Deployment > Compiler > Annotation Processors
(IntelliJ wrap line at 120 spaces:
+ format: Settings / … / Code Style / JAVA / Wrapping and Braces / Ensure right margin is not exceeded = Yes
+ typing: Settings / … / Code Style / JAVA / Wrapping and Braces / Wrap on typing = Yes
Pingback: IDEA Tomcat HotSwap | DucQuoc's Blog
When you install HotSwap plug-in with IDEA, it’s recommended to use the “always Build” feature, instead of Ctrl+F9 manually.
However, some IDEA plugins may rely on third-party lib to run and may crash the compile-server. Especially the “SNAPSHOT” version of springloaded and HotSwapAgent. If you meet such problem, for example “SLF4J no binding”, download slf4j-simple JAR :
and put it into classpath of the compile-server, or simply the lib folder of the plugin: