Git helps is maintaining the history of the project. It maintains a record of what changes were made to a project , when and by whom.
Github is an online platform that hosts git repository.(Repository is a folder which saves all changes).
Hacktoberfest
is an open-source competition
open to everyone in our global community. Whether you’re a developer, student learning to code, event host, or company of any size, you can help drive growth of open source and make positive contributions to an ever-growing community. All backgrounds and skill levels are encouraged to complete the challenge.
Hacktoberfest
is a celebration open to everyone in our global community.Pull requests
can be made in anyGitHub-hosted
repositories/projects.- You can sign up anytime between
October 1
andOctober 31
.
To earn your Hacktoberfest T-Shirt
or tree reward, you must register and make four valid pull requests (PRs) between October 1-31
(in any time zone). PRs can NOT be made to any public repo on GitHub, maintainers have to opt in with the topic Hacktoberfest
on the repo. If a maintainer
reports your pull request as spam
or behavior not in line with the project’s code of conduct, you will be ineligible
to participate. This year, the first 70,000
participants who successfully complete the challenge will be eligible to receive a prize
.
- Any
github
repository with theHacktoberfest
topic - For the sake of convenience, you can contribute to this very project :)
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 for Windows User
- Git installation Video for Mac User
- Git installation Video for Linux User
- 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 ```
The same command can also be divided into the following -
1. Fetching all commits from upstream
git fetch --all --prune
2. Reset the main branch of origin to upstream
git reset --hard upstream/main
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]
It is easy to solve
Solution: You just have to update the URL of the remote repository with the name "origin" to the URL of the remote repository you want to add
git remote set-url origin <repository url>
This error appears when some of your ambiguous actions confuse Git on how to function further.
Solution: The solution to this fatal error is to use –allow-unrelated-histories flag with the git pull command or git merge command.
git pull origin master –allow-unrelated-histories
This is the SSL certificate of the server that has not been signed by a third party, so an error is reported.
Solution: This error is most likely caused by network instability and connection timeout.
git config http.sslVerify "false"
NEVER commit on the main branch.
The importance of adding a new branch is that we can work on the code until our changes are finalized. Suppose you are working on a project that needs x changes. It will be easier for the maintainer to review changes one at a time instead of all the changes in a single PR. The maintainer can easily suggest changes in your PR on a particular issue.
After finalizing and completing the code, the branch can be merged with the main branch.
1 branch can only have one PR.
git checkout <branch name>
git checkout -b <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
Configuring user information used across all local repositories
Configuring user information, initializing and cloning repositories
Working with snapshots and the Git staging area
Isolating work in branches, changing context, and integrating changes
Examining logs, diffs and object information
Retrieving updates from another repository and updating local repos
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
https://youtu.be/apGV9Kg7ics
This video will help you to begin with Git and Github and start hosting projects on github or work on existing projects.
Arpit Jain |
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 |
Cool Front-End Templates | HTML , CSS , Bootstrap |
Amazing Css effects | HTML , CSS , Bootstrap |
Amazing Js Projects | HTML , CSS , Bootstrap, JS |
Web-Development-Path-And-Resources | Documentation |
Open-Source-Programs | documentaion |