Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Work With Git From Command Line (Windows)

DZone's Guide to

How to Work With Git From Command Line (Windows)

Learn how to use the command line to work with Git in Windows.

· Agile Zone ·
Free Resource

Discover how you can take agile development to the next level with low-code.

It’s very important to know the commands behind the UI in Visual Studio, in this post I just explain the basic you need to work with Git from the command line.

The first step is to set the global settings, but first list display what its value is.

git config –global -l

If there is no settings it will tell you no such a file, if there is data it will be displayed as the following:
git config --global -l

If you open the user folder, you can see that file .getconfig, also if you open the Visual Studio and navigate to global settings you will find that this info has been set too.
.gitconfig

I can also edit this file using VIM:
git config --global -e

This will open Unix editor, to quite that window I need to type :q +enter.

You can press i to start entering text and save by pressing esc and :wq and enter, this will commit with the message you typed. In your current state, to just come out without committing, you can do :q
git config --global -e edit

If you open the file without a proper exit, it will create a swap file and you can’t open it again smoothly, you just need to delete that swap file or close the file as mention before

.gitconfig.swp

Navigate to the directory you want to use and type:
git init
git clone https://github.com/youraccount/rep

This will copy all files to your local files, try to add new file and then add it using git add

Try to see the status using git status

Commit the changes git commit -m ” your message”

Download this eBook to learn how to prepare your business for agile adoption, how to ensure the proper business-IT collaboration that is critical for agile development, and how to choose the right stakeholders to increase productivity and enable accelerated time-to-value.

Topics:
windows ,git ,command line ,scm

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}