Git clone Command
In this page:
git clone repository_url [directory_name]
git clone क्या है?
git clone <url> एक remote repository की एक complete copy -- हर commit, हर branch, पूरी history -- एक step में आपकी machine पर download करता है, आपको एक पूरी तरह independent local repository देते हुए जो तुरंत काम करने के लिए ready है।
उदाहरण: What is git clone?
git clone https://github.com/user/repo.git
एक Remote URL से Clone करना
Cloning HTTPS या SSH URLs पर काम करता है, और दोनों तरीकों में Git automatically उस source की ओर point करने वाला origin नाम का एक remote connection बनाता है, इसलिए future push और pull commands को exactly पता होता है कि कहाँ sync करना है।
उदाहरण: Cloning from a Remote URL
git clone https://github.com/user/repo.git
git remote -v
एक Specific Folder में Clone करना
Default रूप से cloned folder का नाम खुद repository के नाम पर होता है, लेकिन git clone <url> <folder-name> आपको एक custom directory name में clone करने देता है -- तब उपयोगी जब आपके पास पहले से उस नाम वाला एक folder हो, या कुछ ज़्यादा descriptive चाहिए हो।
उदाहरण: Cloning into a Specific Folder
git clone https://github.com/user/repo.git my-folder
एक Specific Branch Clone करना
Cloning आमतौर पर सिर्फ default branch checkout करती है, लेकिन git clone --branch <name> <url> आपको सीधे एक specific branch clone और checkout करने देता है, बाद में branches switch करने का extra step skip करते हुए।
उदाहरण: Cloning a Specific Branch
git clone --branch develop https://github.com/user/repo.git
Cloned Remote Check करना
एक clone के तुरंत बाद git remote -v चलाना आपको वह origin URL दिखाता है जो Git ने automatically configure किया -- यह एक quick sanity check है कि आप actually intended repository की ओर pointed हैं।
उदाहरण: Checking the Cloned Remote
git remote -v
git cloneचलाना और फिर नए folder के अंदरgit initचलाना, जबकि clone पहले से एक repository है।- Git commands चलाने से पहले cloned folder में
cdकरना भूल जाना, ताकि Gitnot a git repositoryकहे। - यह उम्मीद करना कि
git clonecopy को up to date रखेगा, जबकि बाद के changes fetch करने के लिए आपकोgit pullचाहिए।
Chapter Quiz — Complete all 18 topics to unlock
0/18 topics done
Complete these topics first:
- Git init Command
- Git New Files
- Git Staging Environment
- Git clone Command
- Git status Command
- Git help Command
- Git add Command
- Git commit Command
- Git tags Command
- Git stash Command
- Git log Command
- Git diff Command
- Git show Command
- Git rm Command
- Git mv Command
- Git restore Command
- Git clean Command
- Git ignore (.gitignore)