This reminds me of something I perform all of the time... not pure bash, but helpful nonetheless.
I have about ~50 git repos I'm pulling down and tracking (others' projects, not mine), so this gnu parallel command says "enter each git repo in the current dir and perform a git pull".
cd path-to-git-repos
parallel cd{}\; git pull ::: `ls`
Best part ... it runs in parallel. So I have 4 cpus and the git repos have nothing to do with each other... it runs four pulls at once.
It uses the output of the command as an input source. $(ls) would have done the same thing... I like to think of it as performing the operation on a current set.
It doesn't look familiar because its a specific parallel command option, not a general bash option.
Another silly example of a clock-counter ... the -k flag says keep the order (so things don't happen out of order). Perform an echo operation on three sets.
GitLab, unlike GitHub, lets us do this nifty thing where we don’t have to use the website to make a new repository first.
Wow, that really illuminates how Github forces us into suboptimal routines. Another example is updating a fork, that should really have been a single button click, not the local pull-push wrestlings.
A *very* seasoned software engineer, I wrote my first basic game, a lunar landing game, in Basic in 1969. Currently I am doing web development in Ruby on Rails, JavaScript, Elm.
Github has a utility called hub which provides the ability to create repos, fork them, create pull-requests, and few other things. It's meant to be a substituted for the git command since it implements all the git subcommands as well. github.com/github/hub
It's still not as cool as gitlab's "push-to-create"
I have been using hub but didn't know that was possible.
But I have now tried and failed to get it working:
hub create
Error creating repository: Unauthorized (HTTP 401)
Bad credentials
Don't know if that is my hub version 2.2.9, and I can't get their latest version work, probably due to my old OSX, even though none of the errors said that.
No comparison with Gitlab in both convenience and usability, where there is no need to download anything.
A *very* seasoned software engineer, I wrote my first basic game, a lunar landing game, in Basic in 1969. Currently I am doing web development in Ruby on Rails, JavaScript, Elm.
Senior DevOps Engineer with 11+ years of experience. Otherwise an avid artist, reader, cinephile & football fan. Looking forward to connecting with everyone :)
Nifty aliases to simplify daily Git tasks, Victoria! Adding a few more I made that might help:
# Setting upstream on creating a new branch in any GIT repo
function git-new-upstream () {
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
}
# Check if branch on local exists on remote, provide branch name as $1
function git-remote-check () {
git ls-remote --heads origin $1
}
Note: These should be added in .bashrc & then reloaded either via by source .bashrc or opening a new terminal session
This reminds me of something I perform all of the time... not pure bash, but helpful nonetheless.
I have about ~50 git repos I'm pulling down and tracking (others' projects, not mine), so this gnu parallel command says "enter each git repo in the current dir and perform a git pull".
Best part ... it runs in parallel. So I have 4 cpus and the git repos have nothing to do with each other... it runs four pulls at once.
That’s awesome!
Would you explain the
:::part? I haven’t seen this syntax before. All I can find is that:meanstrueor something like that.It uses the output of the command as an input source. $(ls) would have done the same thing... I like to think of it as performing the operation on a current set.
It doesn't look familiar because its a specific parallel command option, not a general bash option.
Another silly example of a clock-counter ... the -k flag says keep the order (so things don't happen out of order). Perform an echo operation on three sets.
Wow, that really illuminates how Github forces us into suboptimal routines. Another example is updating a fork, that should really have been a single button click, not the local pull-push wrestlings.
Github has a utility called
hubwhich provides the ability to create repos, fork them, create pull-requests, and few other things. It's meant to be a substituted for thegitcommand since it implements all thegitsubcommands as well. github.com/github/hubIt's still not as cool as gitlab's "push-to-create"
I have been using hub but didn't know that was possible.
But I have now tried and failed to get it working:
Don't know if that is my hub version 2.2.9, and I can't get their latest version work, probably due to my old OSX, even though none of the errors said that.
No comparison with Gitlab in both convenience and usability, where there is no need to download anything.
This is something I set up so long ago, I don't even remember what I did.
All props to Gitlab for making it painless
Nifty aliases to simplify daily Git tasks, Victoria! Adding a few more I made that might help:
Note: These should be added in .bashrc & then reloaded either via by source .bashrc or opening a new terminal session
I learned about the
xargscommand. Thanks a bunch!I’m so glad! You’re welcome!
Very interesting.
I made something similar for Bitbucket : github.com/Shosta/DLBitbucketRepos
It clones all the repositories you own on Bitbucket.