git init project-name
git remote add origin link-to-remote-repo
Origin is how you name the remote. Usually people name it "origin".
git clone link-to-remote-repo
git add filename
or git add .
git commit -m "Message text"
git push --set-upstream origin branch-name
- when pushing for the 1st time if branch is not master
git push origin branch-name
If this error:
try to add remote: git remote add origin link-to-remote-repo
git pull
, but it's better to specify the branch:
git pull origin branch-name
If new files do not appear locally after pulling: git fetch
Create branch: git branch branch-name
Checkout branch: git checkout branch-name
Show branches: git branch
- the current branch is with *
Create and checkout at the same time: git checkout -b branch-name
Merge: git merge branch-name
.gitignore: a file to which you write other files and folders you do not want to track (to push)
If gitignore is updated but newly included files are still tracked, try this:
git add .
git commit -m "message"
git rebase branch-name
Display git configuration:
git config --list
git config --global --list
git config --local --list
Local:
git config --local user.name "User Name"
git config --local user.email email
Global:
git config --global user.name "User Name"
git config --global user.email email
cd full-or-relative-path
- navigate to folder
dir
- show contents of the folder
dir /a
- show contents of the folder including hidden files
cd ..
- move back to the parent folder
rmdir folder-name
- delete a folder
rmdir /s folder-name
- delete a non-empty folder
echo some text text that can include spaces > filename
- write text to a file
more filename
- print out the contents of the file