Over a million developers have joined DZone.

How to Work With Git From CLI in Win*

DZone's Guide to

How to Work With Git From CLI in Win*

DevOps can't run without Git, and many enterprises are married to a Win* stack. This how-to will get you running Git from CLI like clockwork.

· DevOps Zone ·
Free Resource

Learn how integrating security into DevOps to deliver "DevSecOps" requires changing mindsets, processes and technology.

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

  1. Set the global settings, but first display its value.

    git config –global -l

    N.b. If there is no set value, it will tell you "no such a file," but if there is data it will be displayed as the following:

    git config --global -lIf you open the user folder, you can see ."gitconfig," and if you open the Visual Studio's global settings, you will find that this info has been set there too..gitconfig

  2. I can edit this file using VIM, the most famous of all *nix editors. 
    git config --global -e To quit, type :q +enter; you can key "i" to enter text and save by pressing "ESC" and :wq and enter, this will commit the message you typed. In your current state, to just come out without committing, you can do :q
  3. git config --global -e edit

    If you open the file without a proper shutdown, it will create a swap file which you can’t open again smoothly. You just need to delete that swap file or close the file as mentioned before.


  4. Navigate to the working directory and type:

    git init
    git clone https://github.com/youraccount/rep
    This will copy all files locally. The vodeblock below carries basic references for adding new files, committing, changing the branch, and publishing changes:

    # Add new files
    git add .
    # Get status
    git status
    # Commit
    git commit -m ”your commit message”
    # Change branch
    git checkout branchName
    # Push
    git push https://github.com/youraccount/rep

Learn how enterprises are using tools to automate security in their DevOps toolchain with these DevSecOps Reference Architectures.

git ,devops ,visual studio

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}