11/02/2021 - git commands for remote repo

git commands

inital upload:
git init
--create github repo, copy the url
create .gitignore, add in /node_modules, .env etc
git commit . -m '<msg>'
git remote add origin <url>
git checkout -b <branch>
git push origin <branch>

deleting folder: (in case you added node module by accident)
git checkout <branch>
git rm -r <folder>
git commit . -m '<msg>'
git push origin <branch>

adding/deleting/checking remote:
git remote add origin <url>
git remote -v
git remote remove origin

updating file:
git commit . -m "<msg>"
git push origin <branch>

cloning from remote to local, updating changes from local to remote:
--within working folder
git init
git clone <url> --> you get a subfolder with the cloned repo
cd into the cloned folder
git commit . -m "<msg>"
git add remote origin <url>
git fetch origin
git push origin <branch>

amend single file:
git commit <file> -m '<comment>'
git push origin <branch>

error LF will be replaced by CRLF:
git config core.autocrlf true


rollback to previous
https://www.youtube.com/watch?v=FdZecVxzJbk
git commit -->version that you want to be able to rollback to
git checkout <file>

git status
git diff

Comments

Popular posts from this blog

green tea bitch

song

20231104