Wednesday, 20 December 2023

 ----> Clone a project <----



git clone <Repo URL>

> git clone git@github.com:microsoft/vscode.git

> git log

> git log --pretty=oneline

> git tag



The git checkout command may occasionally be confused with git clone.

The difference between the two commands is that clone works to fetch code 

from a remote repository, alternatively checkout works to switch between 

versions of code already on the local system.


----> Git branch <----


1. Create a branch

> git checkout -b <new-branch> - new branch will be created and we will switch to new branch

> git branch <new-branch> - new branch will be created

> git switch -c <existing-branch> - another command


2. Switch between (Existing) branches

> git checkout <existing-branch>

> git switch - -=- Switch to previous branch



3. list branches

> git branch

> git branch --all


4. Delete a branch

> git branch -d <Name-of-branch-need-to-be-deleted>


5. Add to Remote Repo using new branch name

> git push origin <new-branch>


6. Show git Log Graph

> git log --graph 



----> Git Merge <----

1. Switch to where we need to merge

> git switch <Target-Branch>


2. fire merge command

> git merge <Source-Branch>




No comments:

Post a Comment

 ----> Clone a project <---- git clone <Repo URL> > git clone git@github.com:microsoft/vscode.git > git log > git log -...