Saturday, August 29, 2020

Pushing and Pulling Commits between Visual Studio Code and Github.com

CREATE NEW REPO, empty, from the github server side: (leave out README.md)
When presented with new URL, copy the URL
Locally, mkdir myrepofolder, cd myrepofolder, and create README.md (case-sensitive)

git init
git add README.md
git commit -m "first commit"
git branch -M master
git remote add origin https://github.com/mygithubusername/myrepofolder.git
git push -u origin master

PUSH COMMITS TO GITHUB
git add README.md
git commit -m "ongoing edits"
[master 6c0e1bd] ongoing edits
1 file changed, 1 insertion(+), 5 deletions(-)
git push -u origin master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 328 bytes | 328.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/myusername/myrepofolder.git
383e4f7..6c0e1bd master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'


PULL COMMITS FROM GITHUB
git pull origin master

TIPS FOR USING THE VIM EDITOR
i edit and use arrow keys to navigate
esc finish editing
:w!enter save changes
:q!enter quit VIM EDITOR
# comment-out line character

No comments:

Post a Comment