1. The first thing you need is Git installed on your system, if it is not installed then download it as per your OS and install it.
- Download Git as per your OS.
- Git installation Video as per your OS.
- Install Git
- Open the Git Bash ( Right Click )
- Run the Commands
- You should be able to see your entered name and email under user.name & user.email
$ git config --global user.name "Your Name"
$ git config --global user.email [email protected]
$ git config --list
- Download Vs Code as per your OS.
- Vs Code installation Video as per your OS.
- Fork this Repository or Project
- This will create a copy of this repository in your account.
- Copy the link of the Repository
- Open Git bash where you want to clone the project and clone it
- Clone it
- Run Command and Hit Enter
git clone <the link you just copied>
In this case it is
git clone https://github.com/arpit456jain/Getting-Started-with-open-source.git
- After you hit enter you will notice that some downloading will start. It's actually cloning of repo form your GitHub repository to your local system.
- After this you will notice a folder is created with the name of repository
- Then just close the Git bash and open this folder in your preferred text editor...
- Here is an example in VS Code.
5. Now Make necessary changes and commit them , lets say you have to add your name in readme , you already set up the project in local system . Now before starting your work always rembember to pull latest change from the main Repo.
- Fetch And Merge
- Pull these changes in your local system
- make a new branch and then make the changes , then commit them. make sure to commit to the new branch
Never commit in master branch - After commiting your changes on your local host you have to push that changes to GitHub , make sure you push the new branch
``` git pull origin master ```
git checkout -b new_branch_name
git add -A
git commit -a -m "message"
git push origin new_branch_name
- when you push the changes you will notice a new branch will be created on GitHub and there will be a green button for creating pull request. Click on it.
- After this a new page will be open like this
- Now add a title and description of your PR and click on create pull request.
- Congrats 🎉 your Pull Request is created
This is most common error you will find and its pretty easy to solve .
Solution: You just have to pull latest changes to your local system first and then you can push them
git pull origin master
Note : if your repo is a forked one and its some commit behind then first fetch n merge then pull changes
Its pretty easy to solve .
Solution: You just have to write your username and email
git config --global user.name "Your Name"
git config --global user.email [email protected]
git checkout <branch name>
git init <repository name>
git diff
git diff --staged
gif diff <branch1> <branch2>
git add <file path>
git add .
git branch
git branch <new branch>
git branch -d <branch name>
git log
git log -p -1
git merge <branch_name>
Remove files or directories from the working index (staging area). With git rm, there are two options to keep in mind: force and cached. Running the command with force deletes the file. The cached command removes the file from the working index. When removing an entire directory, a recursive command is necessary.
git rm --cached <file name>
git rm -f <file name>
git rm -r --cached <directory name>
git rm -r -f <file name>
To save changes made when they’re not in a state to commit them to a repository. This will store the work and give a clean working directory. For instance, when working on a new feature that’s not complete, but an urgent bug needs attention.
git stash -u
git stash pop
git clear
A GitHub conflict is when people make changes to the same area or line in a file. This must be fixed before it is merged in order to prevent collision in the main branch.
-
To read more about this, go to Github Docs - About Merge Conflicts
-
To find out about how to fix a Git Conflict, go to Github Docs - Resolve Merge Conflict
Arpit Jain |
Ankita Puri |
Thanks go to these Wonderful People 👨🏻💻: 🚀
Contributions of any kind are welcome!
Open Source Programs click here
Project Name | Tech Stack |
---|---|
PixelVibe | HTML , CSS , Bootstrap , Java Script , Python , Django |