Friday, June 14, 2019

Git commands




rd .git /S/Q
..............................................................................................................
git status
git add index.html
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
.............................................
remove
1. git add
2. git rm --cached index.html
..............................................
add all js file
1. git add *.js
..............................................
1. git add .
.............................................
message or Save change
1. git commit -m "Initial commit"
...........................................
1. git push
...........................................
create a branch
1. $ git branch
2. $ git checkout newBranch
 ie switch to newBranch
................................................
Back to master
1. git checkout master
..............................................
merge
1. git branch
2. git checkout master
3. ie now master branch
4. git merge newBranch
..........................................................................................................................................................................................................................









.............................................................................................................................................................................................................................
..........................................................................................................................................................................................................................
..........................................................................................................................................................................................................................

..........................................................................................................................................................................................................................

..........................................................................................................................................................................................................................



Important URL
https://belev.dev/how-to-effectively-use-git-rebase-onto?fbclid=IwAR1TydHAai8EG4AG97eMwmweOvEEhiZ1Au896phBwrFHj3o-HG4CcauQc8Y

..........................................................................................................................................................................................................................
Git 
 clone, config, commit, init, remote, branch, log, conflict, push, Pull, Fetch, fork, SHA1





git clone
Origin is remote server, Add one or more  remote server to our local repository like here upstream

git remote add origin https://
git pull upstream master -v https://

Commit
git commit -m "Commit #1"
git commit -am "Commit #1"

git config
git config --global user.email "s@gmail.com"
git config --global user.email
git config --list

branch
git branch
git branch -a                                  //list of branches
git branch branchName               // Just create a new Branch
git checkout devbranch 
git checkout -b feature              // Switched to a new branch 'feature'
git branch -d branchName       // deleted the branch
git branch -D master 

Git
git log

Git Push
command -> git push -v
1. Pushing changing to Remote Repository.
2. Pushing new created branch to Remote Repository
  for Example git push --set-upstream origin devBranch 
ie other branch

Conflict



Git Remote
git remote
git remote -v
git remote show origin
git remote rm upstream 
git remote rm origin

Fork
Clone the Forked Repository to Local.
Add one and more remote server to our local Repository
for Example -> git remote add upstream https:// 
git remote
  • origin
  • upstream
git pull upstream master -v
file3.text


Pull
Why do we need a pull request
Remote Repository -> Forked Repository

pull is is Add on Funtionality by Github
vive-verse



Ftech

merge and rebase

The Difference between them is simple in merge both the branches are merge and the last commit of the both the branch becomes the part of the new commit object which is created.

In case of rebase new commits are created with the same content and have difference Hash as it is new. The newly created commit will start pointing to last commit of the base branch and the master and HEAD pointer will move to the last the commit which in the new commit series.

Steps to follow:
1) git checkout DevBranch
2) git rebase master
3) git checkout master
4) git merge DevBranch

Happy Coding :)
..........................................................................................................................................................................................................................
How to create and setup SSH
Generating a new SSH key and adding it to the ssh-agent
Open a github bash and type the below command
ssh-keygen -t ed25519 -C sapanindia@gmail.com
or 
ssh-keygen -t rsa -b 4096 -C sapanindia@gmail.com
Press Enter
Press Enter
Press Enter


$ eval `ssh-agent -s`


$ ssh-add ~/.ssh/id_rsa

id_rsa locations will be below command 
ssh-keygen -t rsa -b 4096 -C sapanindia@gmail.com



$ clip < ~/.ssh/id_rsa.pub



In the upper-right corner of any page, click your profile photo, then click Settings.











Happy Coding :)
..........................................................................................................................................................................................................................















No comments:

Post a Comment