GitHub & Git
- satyanarayan behera
- Jul 26, 2022
- 2 min read
GitHub is a code hosting platform for version control and collaboration
At the heart of GitHub is an open source version control system (VCS) called Git. Git is responsible for everything GitHub-related that happens locally on your computer.
Version control :
We put a file into the version control.
Each updated content maintained in new version.
In case we want to roll back to any old version, that also can be done.
Creating a repository
A repository is usually used to organize a single project. Repositories can contain folders and files, images, videos, spreadsheets, and data sets -- anything your project needs. Often, repositories include a README file, a file with information about your project. README files are written in the plain text Markdown language.
Creating a branch :
<> Code
Click on Main
Create a Branch - like Staging // Fork/Copy the repository
Now all the files are copied to Main to Staging
Opening a pull request
Pull requests are the heart of collaboration on GitHub. When you open a pull request, you're proposing your changes and requesting that someone review and pull in your contribution and merge them into their branch. Pull requests show diffs, or differences, of the content from both branches. The changes, additions, and subtractions are shown in different colors.
Edit the contents of file in staging branch
Commit changes
Pull request
Create a new Pull request
Merge Pull request
Merge Pull request
Sometimes, a pull request may introduce changes to code that conflict with the existing code on main. If there are any conflicts, GitHub will alert you about the conflicting code and prevent merging until the conflicts are resolved. You can make a commit that resolves the con

flicts or use comments in the pull request to discuss the conflicts with your team members.
In Local machine
, we are going to create our version controlling.
From CMD
Create a directory
Go inside the directory
Create a file, update some content
Create GIT - Local repository, # git init
We have to Add the file under GIT and start tracking, staging Area # git add finlename.xtn
To add all file in Git and should be tracked, #git add.
To commit the changes # git commit -m “remark that show the status of update”
To Commit means , the file is in local Repository
To check the commit # git log
To check the changes happened in the file # git diff filename.extn
To rollback to last version submitted, #git checkout filename.extn
git init //git initialize
open file
git add filename.xtn
git add . // all files added to staging area
git commit -m "complete 1 editing" // to commit with remark, file is now in local repo
git log // to check
Git checkout filename// to revert back to lastest copy from Local repo
Gt diff // to get the differences
# gitignore
It’s a process, where we can specify the list of files, those to be ignored or not pushed by/to Git.
# touch gitignore // it’ll create a gitignore file.
We have list down the file names, those to be ignored by Git, each filename should be mentioned in separate lines.
Git cloning
To Clone or copy from the remote repo to local system
# git clone gitfilepathurl
Comments