Learn Git + Github
You can initialize local git repo by using git init
command
Hope you have downloaded git from link
Clone this repo git clone
command
git clone https://github.com/PracticalEdges/LearnGitPlusGithub.git
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
This will configure git on your local
You can either setup gpg or ssh for your git account for github
# For ssh the below works
git config --global gpg.format ssh
git config --global user.signingkey /PATH/TO/.SSH/KEY.PUB
# For gpg keys
git config --global --unset gpg.format
gpg --list-secret-keys --keyid-format=long
git config --global user.signingkey examplekey
git config --global commit.gpgsign true
But we will show you a fun way to login to github without this hasel. That will be at the end
- Click on fork button
- Make sure to untick the copy main branch only
git checkout -b my-first-branch
# it is important to take pull from main whenever possible
git pull origin main
After branching out
- Correct the code located in fun.py
- Command to test code locally:
python -m unittest discover -s . -p "test_*.py"
- Push the code using below command
# stage the file
git add .
# commit the changes locally
git commit -m "corrected code"
# push to branch
git push
-
Make Sure to enable actions in forked repo & go to github and check the PR section
-
Click on
compare & pull
-
Or you can click on
New pull request
. After that-
In the base: dropdown, make sure main is selected.
-
Select the compare: dropdown, and click
my-first-branch
. -
Select the compare: dropdown, and click
my-first-branch
. -
Add title as
my first pr
-
Click Create pull request . You will automatically be navigated to your new pull request.
-
Wait about 20 seconds then refresh this page to see github action magic
-
Then Merge the PR
- Once PR is merged readme will change
-