I have a BASH script to go through my Git projects recursively and pull them. We use two branches, master and development. When I change the script to include && git checkout development, my script fails to run and I get this error:
find: missing argument to `-exec'
When I remove the && git checkout development part again, the error remains the same even though the script is reverted to its initial state.
Here is the script:
#!/bin/bash
find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull && git status" \;
And here it is with the Git checkout call (and removing git status):
#!/bin/bash
find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git checkout development && git pull" \;
What is going on here? Is it possibly a red herring that the issue only occurs after changing the script?
find . -type d -name .git -exec sh -c 'cd "$1"/../ && pwd && git checkout develop && git pull' _ '{}' \;"$1"part of it pulling in a command line argument, or doing something different?find . -type d -name .git -exec sh -c 'readlink -f "$1"/../ && git -C "$1"/../ checkout develop && git -C "$1"/../ pull' _ '{}' \;