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.
Join the DZone community and get the full member experience.Join For Free
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:
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:
- I can edit this file using VIM, the most famous of all *nix editors.
To quit, type
:q +enter; you can key "i" to enter text and save by pressing "ESC" and
:wqand enter, this will commit the message you typed. In your current state, to just come out without committing, you can do
Navigate to the working directory and type:
This will copy all files locally. The vodeblock below carries basic references for adding new files, committing, changing the branch, and publishing changes:
git init git clone https://github.com/youraccount/rep
# 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
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.
Published at DZone with permission of Mohamed Radwan, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.