cd <foldername>
: navigate to where you want to make a new folder
take <foldername>
: create a new folder and navigate in it (take
is a combi ofmkdir
andcd
)mkdir <foldername>
: create new folders you needtouch <filename>
: create new files you needtouch README.md
: create aREADME.md
to describe your projectgit init
: initiate git in your first created folder, when all files and folders are createdtouch .gitignore
: create a.gitignore
- filels -la
: look for hidden files, you dont want to uplaod to Git / Githubecho '.DS_Store' >> .gitignore
: write filenames and folders in.gitignore
git add -A
: add everything to the Stage (Stage is a pool for commits)git commit -m "Initial commit"
: Initial commit (Commit messages should start with a capital letter)
- Create a new Repository on GITHUB (https://github.com/)
- repository-name = local-folder-name
- choose public or private (public is recommended)
- don't initialize this repository with a readme or gitignore
- next Page: Quicksetup
- choose SSH
- copy and paste first link in Terminal (to connect your local repository with your remote repository):
git remote add origin git@github.com:USERNAME/REPOSITORY.git
- press Enter
-
git push -u origin main
ORgit push
: push the local repository to remote- you will get a message like this:
git push --set-upstream origin main
- copy, paste, enter
- you will get a message like this:
-
now check if the repository is on Github, by refreshing the page of the repository
-
git branch readme
: editREADME.md
and create a new branch -
git branch
: check branch -
git switch readme
: switch to readme-branch -
ls -la
: check if yourREADME.md
is here -
code README.md
: open and edit yourREADME.md
in VS Code (remember this language is Markdown)- save your
README.md
- save your
-
git status
: check changes -
git add README.md
: addREADME.md
to Stage -
git commit -m "Edit README.md"
: commitREADME.md
-
git push
: push to Github
- go in to the repository
- compare & pull request
- leave a comment and create pull request
- IF your Code is reviewed and okay, than merge the pull request
- confirm merge
- delete branch
git switch main
: switch to main-branchgit pull
: pull your Github-Repository with your localgit branch
: check your branchesgit branch -d readme
: delete feature branchgit branch
: Check branch again
-
git init
: initialize git -
git add .
: add all files contents to the stage -
git add <filename>
: add specific file to the stage -
echo ‘<filename>’ >> <destination>
: Write a file on a string -
git commit -m “(description)”
: commit changes to git depository with a description -
git commit --amend -m “(new_name)”
: rename last commit -
git branch <branchename>
: add new branch -
git switch <branchname>
: switch to specific branch -
git switch -c <branchname>
: add a new brnach and switch to specific branch -
git branch -d <branchname>
: delete branch -
git remote add origin <github-link>
: add github connection to local host -
git remote
: shows repository -
git push -u origin <branchname>
: push specific branch to github -
git pull
: pull updates from github -
git pull --rebase
: If you pull remote changes with the flag--rebase
, then your local changes are reapplied on top of the remote changes. After that you can usegit push
git branch
: displays which branches exist in filegit status
: displays status - changes in the file, that are not up to date with gitgit log
: displays all commitsgit log --oneline
orglo
: displays commits in shortergit log --graph
: displays graph with all branches