Git 101

  • What is a modern VCS i.e git

  • How is it different from the ABAP version management

Traditional Version Control System:

Check out file --> Modify --> Check in new version

Decentralized Version Control System:

Everyone has local copy --> Modify and upload to master version control

GIT Flow:

GIT Steps:

0. git pull
1. git add
2. git commit -m "message to the moon"
3. git push
4. git pull

How to install, configure a repo and use GUI or cmdline to manage a project

git config --global user.name 'myuser'
git config --global user.email 'myemail@mydomain.com'
git add -h (better than --help)

Either/Or

  1. Local codebase to git (uncommon -it's usually the second option below)

git init
git status (--short)
touch .gitignore
git add -A
git reset && git status || git rm --cached ONEFILE && git status

2. Git repo to local (common -like hypeyledgy. You're already a developer with access to a project. Code away after you clone it. )

git clone <url> dir
git remote -v
git branch -a
git pullorigin master ( !! Always check you're on latest version with a pull !! )
git pushorigin master
git diff --staged ( after a git add )
git commit -a -m " git add & git commit in one! "

Nitty gritty and useful

git log -p --since=" 2 weeks ago "
Pages 1-100 Page 3
git log -p --since=" 2 weeks ago "
git log -S "codethatisbroken" (the grep)
git commit --amend
git checkout --file ## revert modified file to original
git remote -v
git remote add projectos <url>
git remote show origin
git fetch <url>
git checkout sha-1 . || git reset --hard [sha-1]

Branches

git branch vladut-bugfix
git checkout vladut-bugfix
git push-uorigin vladut-bugfix

Shortcuts

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git mv permissions2.txt permissions.acl
git status
git commit -m "fixed filesname"
git push origin master

Last updated