ch-gopi / Git-Github

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Git-Github

Initializing Git For Version Control

Setting up Git for the first time on a new project is fairly simple, you just need to enter these five commands into your terminal. Be sure to be sitting in the directory where your project is located!

You only need to do this once, right when you start your new project. If you create a completely new project, you’ll have to go through these commands again. But only once per project…

$ git config --global user.name "Your Name"

$ git config --global user.email "you@youraddress.com"

$ git config --global push.default matching

$ git config --global alias.co checkout

$ git init

Pull Requests

Getting Started 🤩🤗:

  • Fork the repo (button on top)
  • Clone on your local machine
git clone https://github.com/ch-gopi/HTML-CSS-JavaScript.git
  • Navigate to project directory.
cd HTML-CSS-JavaScript
  • Create a new Branch
git checkout -b my-new-branch
  • Make your changes folderName/fileName

  • Add your changes

git add .
  • Commit your changes.
git commit -m "Relevant message"
  • Then push
git push origin my-new-branch
  • Create a new pull request from your forked repository

Avoid Conflicts {Syncing your fork}

An easy way to avoid conflicts is to add an 'upstream' for your git repo, as other PR's may be merged while you're working on your branch/fork.

git remote add upstream https://github.com/ch-gopi/HTML-CSS-JavaScript.git

You can verify that the new remote has been added by typing

git remote -v

To pull any new changes from your parent repo simply run

git merge upstream/main

This will give you any eventual conflicts and allow you to easily solve them in your repo. It's a good idea to use it frequently in between your own commits to make sure that your repo is up to date with its parent.

About