Git Hub Codes

Git Hub Codes

cover.png

GITHUB -> It offers the distributed version control and source code management functionality of Git. Parent organization: Microsoft Corporation

Go to github -> Official Website of Github

GIT -> Git is a distributed version-control system for tracking changes in any set of files, originally designed for coordinating work among programmers cooperating on source code during software development.

Go to Gitbash -> Official Website of GitBash

First you need Git Bash (Terminal)

Second Github account

Untracked = you are not tracking the file with the use of git.

Staged = It goes to commit area

Commit = snapshot / saves the file .

Unmodified = You have commited the file and then if you change something in the file it goes to modified.

Here are some commands that are used in gitbash.

$ code . -> Open VS code Editor

$ git init ->Initialized empty git repository

$ ls -lart -> shows hidden folder

$ git status -> shows status

$ git add filename -> Add file

$ git commit -> Save the file .

Then it goes to vim editor , then press I to insert , then type Initial commit , then press esc (exit to insert mode) , then press :wq to exit

$git push -u origin master -> It uploads your code to the github repository.

$ touch filename ->creates a new file.

$ git add -A -> Add all your files at once.

$ git commit -m "more html pages added"

$ git checkout filename -> Accidental files can be recovered.

$ git checkout -f -> All files can be recovered at once.

$ git log -> shows your commit, who commited when commited.

$git log -p -numbers of commit you want to see ->numbers of commit you want to see(press q to exit).

$ git diff -> It checks what you have edited or changed(compares working tree with staging area).

$ git commit -a -m "skipped staging area" -> commit all files at once.

$ git rm filename -> deletes files from working directory and git staging area.

$ git rm --cached filename -> removes file from staging area, yes file is still in your harddisk.

$ git status -s -> Short status of modified in working or staging area.

$ touch .gitignore -> Create a file name gitignore , Some files you dont want to track in github it means that some files that automatically generate random data or it may be log files , you dont want to push it to github , then in that case this gitignore file is helpful .

$ git branch -> It shows branches (master is the main branch it will show and if there is any other branch present , then it will also show).

$ git branch character1 -> character1 is the branch name after master branch.

$ git checkout master -> Switched to branch master.

$ git merge character1 ->It will merge with the master branch.

$ git checkout -b character2 -> It creates the branch character2 and you are in it.

$ git remote -v -> It will give you link to push and fetch .

Lets move to Github Website .

First you need to create your Github account , then create a new repository then you will find a link of that repository . you should paste this link in your local git bash terminal to fetch and push directly . To generate your SSH Keys Go to your github setting then select SSH and GPG keys, then you will find a link to generate your ssh key, click it to genrate. $ ssh-keygen -t ed25419 -C "" Open your git bash and paste it. Then to ensure your ssh is running type in your gitbash command line $ eval ssh-agent -s . Press enter You will find the RSA key copy from your gitbash terminal and add the SSH key in your github account.

And there you can start your journey .