Skip to content

Davinder1436/hello-git

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hey-you-youre-finally-awake-will-smith

Come on in padawan, start your open source journey with a hello-git. Git is a version control system that basically.....let's you have versions. It lets you click a snapshot of your code state and store it in a photo album - the history of your project. Basically no more of this...

Screenshot 2023-10-17 121407


New code doesn't work? Go back to old version
Office on fire? Take a snapshot of your code and upload......oh and leave the building after that
Deleted the entire prod database? Shhhhhh revert to old version. Yeah you get it

You need these things before you go to the next steps:
1. [Install git if you haven't](https://git-scm.com/download/win) (duhhhh)
2. Create a github account
And now we getting started for reals

Step 1: Fork this repo

Would you ever want someone unknown to change your code? Hard pass
So you gotta make your own copy of that code. How?? Just click on fork and follow some simple steps.....Aaaannddd you're done!
Screenshot 2023-10-17 012848

Just remember, your fork is called origin and where you forked from is called upstream

Step 2: Bring it to local

Time to embrace the keyboard.
Open your terminal in the folder you want the code. Run git clone https://github.com/<your username>/hello-git.git
cd hello-git
Set your username and email with git config --global user.name "YOUR_USERNAME" and git config --global user.email "YOUR_EMAIL"
I recommend keeping them the same as your github profile but you can do otherwise if you a lil adventurous.

Set the upstream with git remote add upstream https://github.com/c-d-a-o/hello-git.git
And check all links attached to your repo with git remote -v

Step 3: Make a new branch (el psy congroo)

I know it sounds useless right now but ALWAYS MAKE A NEW BRANCH FOR A NEW CHANGE
This will help you in the years to come. One branch only allows one PR (dunno what this is? we'll cover it). So always make a new one.
git branch newbranch to make the branch
git checkout newbranch to shift to new branch

Keep a descriptive name. Smth like feat: <your-name> works for this one. An example of well made branch names:
Screenshot 2023-10-17 102823

Step 4: Let your cat walk on your keyboard

It's a gatekept secret in the tech world. Walking cats always write the best code. Brownie points for clean documentation.

......Or if you don't have a cat. Just write some code. Like we do (sm1 plz gift me a cat)
hackoru

Step 5: Staging your code

Now we wanna take a snapshot of what we wrote. But what files to include?
This is called staging. We stage the files we wanna include in the snapshot.
Simply use git add file.txt to add file.txt to the staging area
Want to stage all files? git add . is just for you
Wanna remove a file from staging area? git restore --staged file.txt saves the day

Step 6: Time to commit (this is not about relationships)

Now it's time to commit your code to history. Now you can revert shitty code. And others can blame you for shitty code. LITERALLY!

ace-attorney-phoenix-wright
Yeah I wasn't kidding

Screenshot 2023-10-17 111726

Decide on a good message to let others know what you changed. PLEASE make this message good and do others a favour. No one likes to be confused. Just add the message to this: git commit -m "good message" And you're done.....for now

Step 7: Change original code

Remember, all this change is in your own fork. Time to give it back to the OGs. We do this with a Pull Request (PR) which is basically a digital way to say "Hey! Just review this code and merge this into your repo"
First push the code to your remote fork using git push origin <branch-name> Now open your fork on github. Just click on compare and pull request. Add a good description and submit. Done.
Now, wait for the endless list of improvements the maintainer sends which you'll forget to change sit back and give yourself a pat on the back for your first PR.

Step ?? : Now what

As a parting gift, we're giving you the only source you'll ever need for git. No problems. EVER AGAIN. Link .
.
.
.
.
.
.
.
.
Yeah there's none. Keep building, keep learning. I learned this today making this:
Screenshot 2023-10-17 112054
It's never gonna end. You'll stumble along the way - it's a canon event. And then learn even more.
This is how we stay relevant. How we stop ChatGPT from taking our jobs. CDAO, GPT and StackOverflow are your friends in this journey.
Anyways
finnick-zootoropia

About

Want to learn git? You've come to the right place

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 59.0%
  • CSS 35.0%
  • JavaScript 6.0%