0% found this document useful (0 votes)
12 views6 pages

Github/Git

GitHub is a platform for software development and version control using Git, enabling code management. Git is a distributed version control system that tracks changes in files, with commands for initializing repositories, managing branches, and pushing code. The document also outlines steps for adding SSH keys and pushing work to GitHub, including generating personal access tokens for authentication.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Github/Git

GitHub is a platform for software development and version control using Git, enabling code management. Git is a distributed version control system that tracks changes in files, with commands for initializing repositories, managing branches, and pushing code. The document also outlines steps for adding SSH keys and pushing work to GitHub, including generating personal access tokens for authentication.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

GITHUB/GIT

GitHub is a platform for software development and version control using Git, allowing
developers to store and manage their code.
A platform that provides developers to store and manage their code.

Git (also known as VCS) is a tool that provides version control. Git is a distributed version
control system that tracks changes in any set of computer files like when your project is created,
who modified project, which code is deleted, which one is added etc.
Git repository is folder where .init is resides. Git repository is folder where .init is resides.

There are two types of version control:


1) Central version control system:

Drawback of CVCS:
2) Distributed version control system:

Adding a new SSH key to your GitHub account:


When you want to establish connections between github with your ubuntu terminal
1. cd
2. ssh-keygen
3. ls .ssh/
4. cat .ssh/id_rsa.pub
5. copy id_rsa.pub value
6. Go to github settings/SSH and GPG keys/ new SSH key and paste.

NOTE: If connection is not established github will give error

7. git clone https://github.com/umair028/Django-todo.git


Push your work using terminal.
Go inside to your repo where you clone your repo using cd command.
git init: Is used to initialize the folder (It will make the folder which I want to make git.)
git status: To check your current branch, how many commits you did and untrack file (which
shows in red).
git add .: Track your untrack files which means now it is git responsibility if it is deleted.
git restore –staged file_name: Used to undo the added file.
git restore file_name: Restore your deleted files but only track files you can restore.
git checkout -b = Creates new branch.
git checkout branch-name: Switch one branch to another branch.
git pull –all: Download all repository.
git commit -m "comment to represent work.": Comment about your work it compulsory.
git push origin branch-name: push to your work in your branch in github repository.
git branch -a: List all branches (local and remote)
git branch -d [branch name]: Delete a branch.
git merge [source branch] [target branch]: Merge a branch into a target branch.
git remote -v: Show the current Repository.
git log: Show all activities.

Git revert commit_number: Revert all file that was deleted and available in git log.

git remote set-url origin repo_name: Change the one repo to another from one user to another.
Push other’s work to your github repo

 Go to github settings and in the bottom down click developer setting.


 Click personal access tokens and click Tokens (classic) then generate new token.

 Then check your current repo: git remote -v


 If it is showing others repo, then change it to your repo: git remote set-url origin
https://github.com/umair028/Django-todo.git
 Go to your app in you Linux in here django-todo is my app.
Push the app to your repo and it will ask you a username and password so in password
section you can give your generated token because it is saved.

You might also like