Last active
June 26, 2024 08:38
-
-
Save yuya-maemichi-synspective/406de7190d4b3167899d4f65fa071ebc to your computer and use it in GitHub Desktop.
Git snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote | | |
xargs -n1 -I% git symbolic-ref refs/remotes/%/HEAD | | |
cut -d/ -f4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cf. %x`echo exec cmd` | |
def x(cmd) | |
IO.popen(cmd).readlines(chomp: true) | |
end | |
x('git remote') | |
.flat_map{x("git symbolic-ref refs/remotes/#{_1}/HEAD")} | |
.map{File.basename(_1)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git ls-files --cached --ignored --exclude-standard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ref.