I saw the following neat little trick in this link:
# renaming a long file-name using a regex
$ touch config.txt
$ mv config.txt !#:1:s/txt/json
The exact meaning of the
!# is, quoting from the man page:
Event Designators An event designator is a reference to a command line entry in the history list. Unless the reference is absolute, events are relative to the current position in the history list.
! Start a history substitution, except when followed by a blank, newline, carriage return, = or ( (when the extglob shell option is enabled using the shopt builtin).
!# The entire command line typed so far.From ‘man bash’
i.e. most people know that bash can insert things from history using commands like
!50 (i.e. rerun last command and rerun the 50th history item respectively).
!# let’s you take something from the existing line and re-use it.
Here is another example, from here:
curl http://beyondgrep.com/ack-2.14-single-file > ~/bin/ack && chmod 0755 !#:3
In this case,
!#:3 takes the 3rd element from the existing command. Starting from zero, that turns out to be
~/bin/ack in this case.
Update: Looks like subtrees are a nicer alternative to submodules. Anyway..
- To update all submodules:
git submodule update --init --recursive
- To fetch the latest code from a submodule:
git commit -am "bumping up submodule version"
Then merge the code. The next time the parent repository is pulled,
updating the submodule will get the latest commit in it.
bash-4.2 ~$ arping 192.168.0.58 -D -c 3 -I ens32
ARPING 192.168.0.58 from 0.0.0.0 ens32
Unicast reply from 192.168.0.58 [18:E7:28:2E:92:9C] 1.747ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
bash-4.2 ~$ echo $?
- exit status of 0 confirms a duplicate ip
- Instead of a normal pull, try this:
git pull --rebase origin master
git add <some-file>
git rebase --continue
git rebase --abort
git push origin master
From here: https://gist.github.com/hongymagic/6339056
First add this to
.git/config under the
fetch = +refs/pull-requests/*:refs/remotes/origin/pull-requests/*
Then fetch the pull requests:
git fetch origin
Then checkout the one you want:
git checkout pull-requests/1000/from
git cat-file -p <commit>
git show --pretty=raw <commit>
Both these show similar information: the committer, the parent(s), commit text and so on.
Now that you have the two parents of a merged request (see above tip),
you can see all files changed between its two parents with a command
git diff --name-only <sha1> <sha2>