dxiai / zhaw-actup

Metaprojekt für die Entwicklung Digitaler Autonomie mit selbststudienkursen
Creative Commons Zero v1.0 Universal
0 stars 1 forks source link

Georgs Liste der GIT Befehle #3

Open phish108 opened 3 years ago

phish108 commented 3 years ago

On initial install:/ Konfiguration

git --version - checks the version of the installed locally git git config --global user.name "Your Name" - sets up the name of the user git config --global user.email "yourname@somemail.eu" - sets up the mail of the user git config --list - lists all the git configurations

For help on commands:

git help (e.g. git help config) OR git --help

For initializing the project:

git init - initializes the git repo in the current folder touch .gitignore - creates a git ignore file git status - check working tree - both on the git and on local

Add files:

git add -A - adds all of the files for commiting remember - git status - to check the state of the repo

Remove files:

git reset - removes files to be commited git reset somefile.js - removes somefile.js from the commit preparation

Committing:

git commit -m "This is the commit message" - -m is used to add message

Check log:

git log - renders commit ids, authors, dates

Clone a remote repo:

git clone

View info about the repo:

git remote -v - lists info about the repo git branch -a - lists all of the branches

View changes:

git diff - shows the difference made in the files

Pull before push ALWAYS:

git pull origin master THEN PUSH: git push origin master - name of remote repo the branch that we push to

First time push of the branch:

git push -u origin - -u coordinates the two branches (local and on server)

Create a branch:

git branch

Checkout a branch:

git checkout

Merge a branch:

git checkout master git pull origin master git branch --merged - see which branches are merged git merge git push origin master

Delete a branch:

git branch -d - this deletes it locally!!! git branch -a - check the repo branches git push origin --delete - this deletes it from the repo!

bajkad commented 3 years ago

Toll! ich habe den Content in ein neues File '/tools/git_help.md' übernommen. Wahrscheinlich geht es einfacher, indem man ein issue direkt in ein .md file umwandeln und an einem frei wählbaren Ort abspeichern kann. Hat jemand dafür einen Lösungsvorschlag?