Git and version control
git
= colaboration
svn
= version control
Makefile.feld - Git Is Not Revision Control
Feature Branch Workflow
from: Git Feature Branch Workflow | Atlassian Git Tutorial
- feature development should happen off
main
main
is official history
- push feature branches to central repo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# init
git checkout main
git fetch origin
git reset --hard origin/main
# branching
git checkout -b feature/superman main
# work
git status
git add .
git commit
# push to remote
git push -u origin feature/superman
# merge
git checkout main
git pull
git pull origin feature/superman
git push
|
A git Workflow
from Understanding the Git Workflow
Short lived / quick work
Work in feature branch:
1
2
3
4
|
git checkout -b private_feature_branch
touch file1.txt
git add file1.txt
git commit -am "WIP"
|
Instead of merge, run:
1
2
3
|
git checkout main
git merge --squash private_feature_branch
git commit -v
|
Larger work
Rebase into main:
1
2
3
4
5
|
git rebase --interactive main
pick
squash
etc.
|
Too chaotic, start over
Create clean branch and import diff from feature branch:
1
2
3
4
|
git checkout master
git checkout -b cleaned_up_branch
git merge --squash private_feature_branch
git reset
|
then add and commit anew