Clone a Repository
Let’s see how to clone a project from a existing repository. Let’s think I am a new contributor for my friend’s project. So I am going to clone that project to my new folder. Open your new folder and right click on it. Then click “Git Bash Here“.(First you have to install git bash. If you don’t know what is Git Bash Click here ) This article is for Repository Handling.
In the command prompt, write “git clone your_repo_url“. you can get your repo url from the repository. See the image below.
It will automatically download your repository’s files. That’s it. Now your can open that project.
Pushing files to repository
You already know how to push your file to your repository if you read my previous article. If you don’t know it’s okay. “git push -u origin master” is the command. But you have do somethings before you push. Just think your friend’s repo has many contributors. what happen when they are push their file at the same time. If you have an answer. That’s great. Repository has only final person’s files that is push to the repository. That is why github introduce git branch.
Github – Repository Handling | Check the status and Branching
Just type “git status“. You must do this command after your cloned. You can see what is the branch your are working on it. What is a branch in github?
It’s like a tree. A tree has many branches. In here we can similar a tree to our project. So a project can have many branches. In here we can use a branch to each other. type “git branch“, you can see the all branches in the command prompt.
If you want to create your own branch type “git branch [you_branch_name]“. If you want to switch to another branch and check it out into your working directory, you can use “git checkout” command.
Github – Repository Handling | Git merge
we can use “git merge [branch_name]” to merge. But what is merging? Let’s think my branch is “BuildITMasters_designer”. I did my work in this branch. We have a main branch called “master” and I want to add my work to this branch without changing other’s work. For that we can use this command.
Student Developer pack GitHub (GitHub student pack) – Click here to get requirements
Some Git Commands you may need in Version Controlling
- Git basic Commands
- Change files
- Branching and merging
Related Git commands and Tutorials.
Thank you for reading. If you are interesting on my article, make sure to follow my other articles as well. Make sure to leave a comment.
- Android Studio Articles – https://builditmasters.com/category/android-studio/
- Android Studio Firebase Tutorial – https://builditmasters.com/category/android-studio-firebase-tutorial/
- C Programming – https://builditmasters.com/category/programming/
- Flutter – https://builditmasters.com/category/flutter/
- GitHub Tutorials – https://builditmasters.com/category/github/
- Java Programming – https://builditmasters.com/category/java-programming/
- MERN / MEVN Stacks – https://builditmasters.com/category/mern_mevn_stacks/
- Tech News – https://builditmasters.com/category/tech-news/
- Theory Lessons – https://builditmasters.com/category/theory-lessons/
- Adobe Tutorials – https://builditmasters.com/category/adobe-tutorials/
- Best Website for Programming – https://builditmasters.com/category/best-website-for-programming/
- Different Programming Styles – https://builditmasters.com/category/different-programming-styles/
- Earn Money – https://builditmasters.com/category/earn-money/
- Social Word – https://builditmasters.com/category/social-world/