Git commands

# Configure
git config --global user.name "My Name"
git config --global user.email my.name@example.com

# Retrieve code
git clone ssh://<user>@<server>:<project>
git checkout <file>

# Staging code:
git add <file>
git rm <file>
git reset HEAD -- <file>

# Commit staged files:
git commit
git commit -m "commit message"

# Inspecting changes:
git log
git diff
git show

# Synchronizing code:
git fetch
git merge <branch> # merges changes of <branch> into current branch
git pull # merges changes from the remote to the local working space
git push # uploads changes from the local working space to the remote

# Branching
git branch -a
git checkout -b <branch>
git checkout <branch>

# Helper to make http login last longer
git config --global credential.helper 'cache --timeout=3600'  


Presentation

As pptx: Introduction to Code Repository Git.pptx



  • No labels