Git Fundamentals and useful command to use

 

 

 

Create Repo from GitHub site.

Step 1. Create a
local source control path

Step 2. Got to Git
Bash

Step 3. initialize
the git

 

 

 

Linked or remote
origin

$ git remote add
origin “https://github.com/shubh1984/SampleProject.git

 

 

 

Pull

$ git pull origin
master

 

 

Status

$ git status

 

 

Adding file to
local repo

$ git Add file
name

$ git add -A      [add all]

 

 

Commit

$ git commit
filename -m “commit comment”

$ git commit -a -m
“commit comment”    [commit
all]

 

 

Push to remote
server

$ git push  origin master

$ git push -f
origin master

 

 

Fetch [need to do
merge]

$ git fetch origin
master

If server file is
updated than need to do Fetch

 

Check the commit
logs

$ git log

 

 

 

 

 

 

Get list of files

ls

 

 

Branching

There are two
branches local and remote-tracking branches

  1. Creating
    different branch

$
git branch devbranch

  1. Switching from
    master to new devbranch

$
git checkout devbranch

  1. Similar way
    create and add new files in dev branch

 

 

 

 

Merge in-between
branch

$ git merge
origin/master

 

 

 

Rebasing

shubh@LAPTOP-SDS90F74
MINGW64 /c/GitRepos/DesignPatternLocal (master)

$ git rebase
devbranch

 

 

Push to centra
repo

$ git push origin
devbranch

$ git push origin
master

 

 

Revert

$ git checkout
894e167 revert.txt

 

 

Creating key to
stop public publishing

$ ssh-keygen

$ cat
/c/Users/shubh/.ssh/id_rsa.pub

Update the SSH key
in github setting.

 

  • Authenticate

$ ssh -T
[email protected]

Enter the pass
phrase

ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABgQCr1XkZX06v9GlSXGMZ5DBZAha0Xnqa0l2aYVQld2abQVxq7N4v8aJoNua1RtWygrsSLeEgcCyirlh8z+m5yGaV8TCZQJDNYv/CgqCVZYTN9T6OmaC6DEFfs6WNjLs9+hvPKDE7xHlUvr/ctFIoK9EDowY0nmQP64cEOVXCEo+uvBFK/mYPfk6VSWY4sPAQ2K+xGHoGXxNzly0/y0wCXqIegQU1pTHzbHfJeGEA9gTuvSGe3sayTNmFvZr2F5knl2dJDgbxGQWn/F6Mr7Vt3vd8OVpaaDdqub59inAviZq2cGdgu1Flgg8s7ZUpEvXfdKyU/cGluJmTSRqs8Hy88t7sDklyQPfrW5VKApZ7M0/P4fNKGUFM+FU+Vphph6oKYLjtCMjEMrphIMgsz9yKWemiLKMY8V2zYkl7E9geQEbjbXPOtLUAcFAfeYzT+j8nR3Ikbr1Nx4q+UJK9ceBg5SxwPCXwBrhFUTFr/gdVqkg4j1V0Pjfw96brij21aXreAB8=
shubh@LAPTOP-SDS90F74

 

One response

  1. uilliogaber Avatar
    uilliogaber

    The 13 Best Casino Restaurants in Milwaukee, Wisconsin
    This is an interesting piece of information that can 양주 출장샵 help inform your gambler's decision making. 순천 출장샵 For 아산 출장안마 instance, the casino serves up a wide 공주 출장샵 array 여주 출장마사지 of table