Basic git commands for every developers should know


If you're one of those developers who still don't use any version control system, I don't know how you're still managing to get all your work done. so now here I am providing some git commands and you can use also increase your knowledge and work proficiency.



1) git config

Notes: To set your user name and email in the main configuration file.
How to use git commands: To check your name and email type in git config --global user.name and git config --global user.email. And to set your new email or name git config --global user.name = “Bhuwan Paneru and git config --global user.email = “bhuwanpaneru@yahoo.com

2) git init

Notes: To initialise a git repository for a new or existing project.
How to use git commands: git init in the root of your project directory.

3) git clone

Notes: To copy a git repository from a remote source, it also sets the remote to the original source so that you can pull again.
How to use git commands: git clone <:clone git url:>

4) git status

Notes: To check the status of files you’ve changed in your working directory, i.e, what all has changed since your last commit.
How to use git commands: git status in your working directory. lists out all the files that have been changed.

5) git add

Notes: adds changes to stage/index in your working directory.
How to use git commands: git add and git add<filename>.

6) git commit

Notes: commits your changes and sets it to a new commit object for your remote.
How to use git commands: git commit -m "Commit message" Ex: git commit -m ”This is sweet little commit message” 

7) git push/git pull

Notes: Push or Pull your changes to remote. If you have added and committed your changes and you want to push them. Or if your remote has updated and you want those latest changes.
How to use git commands: git pull <:remote:> <:branch:> and git push <:remote:> <:branch:>

8) git branch

Notes: Lists out all the branches.
How to use git commands: git branch or git branch -a to list all the remote branches as well.

9) git checkout

Notes: Switch to different branches
How to use git commands: git checkout <:branch:> or **_git checkout -b <:branch:> if you want to create and switch to a new branch.

10) git stash

Notes: Save changes that you don’t want to commit immediately.
How to use git commands: git stash in your working directory. git stash applies if you want to bring your saved changes back.

11) git merge

Notes: Merge two branches you were working on.
How to use git commands: Switch to branch you want to merge everything in. git merge <:branch_you_want_to_merge:>

12) git reset

Notes: You know when you commit changes that are not complete, this sets your index to the latest commit that you want to work on with.
How to use git commands: git reset <:mode:> <:COMMIT:>

13) git remote

Notes: To check what remote/source you have or add a new remote.
How to use git commands: git remote to check and list. And git remote add <:remote_url:>
14) Delete Branch: git branch -d <branch name>
These are the commands that I feel are essential and get things done, at least for me. Comment here if you think I’ve missed something important or if something can be done differently.
#git #git_commands #commands #git_hub #merge_branch #git_utility #git_developer #git #programmer #vscode_git #vscode #git_push

Comments

Popular posts from this blog

Refresh an Angular Component without reloading the same Component

.NET Core vs .NET Framework: How to Pick a .NET Runtime for an Application

multi color initial(Avatars) if img not available in Angular it's work angular 2,4+ all versions