Created
February 2, 2013 01:40
-
-
Save jhradilek/4695572 to your computer and use it in GitHub Desktop.
A Git alias to copy a file or directory
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
# Usage: git cp [OPTION...] SOURCE DESTINATION | |
# | |
# Options: | |
# | |
# In theory, the command accepts all command line options supported by | |
# the /bin/cp command. In reality, however, only few options are | |
# useful. This includes: | |
# | |
# -R, -r, --recursive | |
# Recursively copies a directory. | |
# | |
# -f, --force | |
# Removes an existing destination file first if it cannot be | |
# overwritten. | |
# | |
# -i, --interactive | |
# Prompts before overwriting existing files or directories. | |
# | |
# -n, --no-clobber | |
# Avoids overwriting existing files. | |
# | |
# -v, --verbose | |
# Informs the user about what is being done. | |
# | |
# Examples: | |
# | |
# git cp en_GB/man1/w2do.1 en_AU/man1/w2do.1 | |
# Copies the "en_GB/man1/w2do.1" file to "en_AU/man1/w2do.1". | |
# | |
# git cp -R en_GB en_AU | |
# Copies all files and directories in the "en_GB" directory to | |
# "en_AU". | |
[alias] | |
cp = "!f() { cp \"$@\" && git add \"${@: -1}\"; }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment