How to use Github with Command line

Using Github with Command line Basics 

git-cli-commands

Clone git repository git commands

git clone URL : 

It will clone the remote repository in to your local file system. It will create folder with repository Name.
[git clone https://github.com/swdcworld/Salesforce.git]

Check Repository status git commands

git Status

It will show the files which are staged, unstaged and untracked. 

[git status]

Checkout the feature branch

 [git checkout origin/branchName]

Create a branch and checkout:

Locally create a branch and the same command to checkout the created branch.
[git checkout -b feature/branchName]

Check differences git commands

git diff

To see the unstaged changes in your working tree using command line.

[git diff]

git diff head

To see both staged and unstaged changes in your working tree.

[git diff head]

Stage changes git commands

 git stage fileName

If you did changes in two files. but you one file is not yet ready, so you can just stage one file. 

[git stage sampleFile.txt]

change sampleFile.txt with your file name. If your file having spaces then wrap it in quotes. 

git stage .

If you did changes in 10 files, then you want to stage all of them. 

[git stag .]

Unstage files git commands

git restore --staged fileName

If you miss something to add, but staged file can't allow to add changes. so you have to unstage it and add your changes. 
[git restore --staged sampleFile.txt]

git restore --staged .

If you want to unstage all the chagnes then use (.).

[git restore --staged .]

Commit staged changes 

git commit -m "your commit message"

You can commit your staged changes. always write your commit message, so that other developers know about your commit. 

[git commit -m "It is a initial commit"]

Change commit message

git commit --amend -m "your correct message"

Sometimes we do mistakes, right. using this command we can correct most recent commit message. 
[git commit --amend -m "your correct message"]

To set the global username and email

To set user email

[git config --global user.email "yourmail@domain.com"]

To set User Name

[git config --global user.name "userName"]

 Push changes to remote branch

To push changes to remote branch using following command.

 [git push remoteBranch]

Merge develop branch to feature branch locally:

first checkout the feature branch, then run this command
[git merge develop]

Update git password in vs code.

git config --global credential.helper wincred



COMMENTS

Name

Apex,6,Batch Apex,2,Chrome Add-on,1,Chrome browser,1,Coding Best Practices,2,CRM Basics,1,cURL,1,Database Query,1,Dataset,1,Dynamic Apex,3,Dynamic SOQL,1,Einstein Analytics,9,Future Apex,1,Git,1,Google Chrome,1,JS for LWC,6,Lightning Components,2,lightning Page,1,Lightning Web Components,13,Linux for Windows users,1,LWC,2,Queueable Apex,1,Redirect page,1,REGEX,1,REST API,1,Salesforce CRM,1,Salesforce Errors,1,Salesforce Interview Questions,13,Salesforce Lightning,1,Salesforce New Features,1,Salesforce Tasks,2,Schedule Apex,1,Test Class,1,Triggers,1,Visualforce Pages,3,Visualforce Pagination,2,VS Code,2,Wave Analytics,7,Winter Release Notes,1,workbench,1,
ltr
item
SWDC WORLD (Software Development Center Of The World) - is a Multi author and Multi Technology Blog: How to use Github with Command line
How to use Github with Command line
How to use Github with Command line ,Using Github with Command line Basics , daily used github cli commands, frequently used git cli commands to learn
https://1.bp.blogspot.com/-qPtq_n0ithw/YPbCOjZsFyI/AAAAAAAAAhM/JfQ6R2yIcgYMlTZ9GhPaOgFEZ1rm0O0lACLcBGAsYHQ/w640-h218/git-cli-commands.jpg
https://1.bp.blogspot.com/-qPtq_n0ithw/YPbCOjZsFyI/AAAAAAAAAhM/JfQ6R2yIcgYMlTZ9GhPaOgFEZ1rm0O0lACLcBGAsYHQ/s72-w640-c-h218/git-cli-commands.jpg
SWDC WORLD (Software Development Center Of The World) - is a Multi author and Multi Technology Blog
https://swdcworld.blogspot.com/2021/07/how-to-use-github-with-command-line.html
https://swdcworld.blogspot.com/
https://swdcworld.blogspot.com/
https://swdcworld.blogspot.com/2021/07/how-to-use-github-with-command-line.html
true
5370056087523941001
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy