Skip to content

Latest commit

 

History

History
122 lines (76 loc) · 3.29 KB

File metadata and controls

122 lines (76 loc) · 3.29 KB

git-logo

Git is a distributed version control system, which means it assists in tracking changes made to files over time, usually source code. In order to oversee the progress of the Linux kernel, Linus Torvalds founded it in 2005. Git keeps track of the changes made by each contributor while enabling numerous developers to work together on a project at once. Learn more git-scm.com/about

GitHub, on the other hand, is a web-based repository hosting platform for Git files. Developers can work together on projects and save their Git repositories in the cloud using this platform. With features like pull requests, code review tools, issue tracking, and project management capabilities, GitHub is a well-liked option for both private and open-source software development projects. Learn more github.com/about

Youtube Video to learn more:

Setup Git

Follow the link to Install Git for respective OS:

Setup GitHub

  • Sign in/Sign up
  • Create a demo repository

Jump to

Git Commands --list

Configure

Configure user information used accross all system/global/local repositories:

git config --global user.name "<github-username>"
git config --global user.email "<github-email>"
git config --global color.ui auto

Verify config:

git config -l

Initialize

Existing directory as a Git repository:

git init

or, clone entire repo:

git clone <url.git>

Staging

Display the status of the repo:

git status

Add files to the staging area:

git add <file-name>
git add .

Unstage file:

git reset <file-name>

Commit changed:

git commit -m "<message>"

Branch and Merge

List available branches:

git branch

Create a new branch:

git branch <branch-name>

Merge given branch with current one:

git merge <branch-name>

Display all commits and branch history:

git log

Path Changes

Delete a file from project:

git rm <file-name>

Change file location:

git mv <existing-path> <new-path>

Share and Update

Add remote URL:

git remote add <alias> <url>

Set remote URL with generated token:

git remote set-url origin https://<username>:<token>@github.com/<username>/<repository>.git

Push the updated files to remote repo:

git push <alias> <branch-name>

Pull updated files from remote repo:

git pull

Generate Token

  • Follow the link https://github.com/settings/tokens (make sure your logged in)
  • Personal access tokens > Tokens (classic)
  • Generate new token > Generate new token (classic)
  • Check the necessary boxes and generate.
  • Save the token in a save file, for future usecase.