Skip to content

Instantly share code, notes, and snippets.

@faiyazalam
Created January 20, 2020 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faiyazalam/6078dc16d9aa1834f95cf2f3d3108885 to your computer and use it in GitHub Desktop.
Save faiyazalam/6078dc16d9aa1834f95cf2f3d3108885 to your computer and use it in GitHub Desktop.
How to do git clone in a non empty directory?
git clone repo-url tmp && mv tmp/.git . && rm -rf tmp && git reset --hard
Explaination:
1) Do git clone in a tmp directory from current directory
2) move .git from tmp to the parent directory of tmp directory
3) reset git from the current directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment