git pull --rebase - use rebase to avoid creating an additional merge commit
git rebase --abort - if there are any merge conflicts you would need to abort the rebase and do a regular pull to resolve the conflicts
When to commit:
Комитваме една функционалност, промяна по функционалност at a time. Т.е. git add . няма да работи винаги, ако сме работили по 4-5 файла паралелно, затова трябва да се аднат само нужните файлове за конкретния комит.
git add file1 file2
Commit message:
Описваме тайтъла възможно най-кратно, до 7-6 думи. Пр. "fix: Change logic for user login from email to username"
Ако работим по файл (а не е някаква генерална настройка) използваме префикси "fix", "feat", "del" и ":" след това. Тях ги пишем с малки букви.
git log --oneline - check all the commits in chronological order.
Git Stash
Use when you want to pull recent commits but you are not ready to commit your code yet. Your code is still under development.
git stash or git stash -u ("u" stands for adding untracked changes, meaning new files that are not present in git repo)
git pull -- rebashe
git stash pop - to pull back your stashed files
fix any merge conflicts
Git commit with message and body
Use it when in a single commit you add for example one big change or feature and in order to fully describe your changes you you need to add a description to your message.
git commit
In your terminal a Vim (the default editor for Git on many systems) opens up
On the first line you write your message
You leave one line empty
On the next lines you may start adding your body (description)
When you're finished use can use the following commands:
Pull steps:
When to commit:
Commit message:
Branching:
Other commands:
Git Stash
Use when you want to pull recent commits but you are not ready to commit your code yet. Your code is still under development.
Git commit with message and body
Use it when in a single commit you add for example one big change or feature and in order to fully describe your changes you you need to add a description to your message.