Git workflow console - intive/patronage21-qa GitHub Wiki

Git workflow - console

0. Prerequisites

git clone https://github.com/intive/patronage21-qa.git
cd patronage21-qa

1. Create branch for a new feature

git checkout master

git checkout master

git checkout -b feature/feature-name

git checkout -b feature/feature-name

git branch -u origin/master

git branch -u origin/master

2. Code/Do_your_stuff -> commit

Display the state of the working directory and the staging area

git status

git status

Stage specific file

git add path_to_file/filename.extension

git add path_to_file/filename.extension

OR

Stage all files (new, modified, deleted)

git add -A

git add -A

git commit -m "feature Commit message"

git commit -m "feature Commit message"

3. (Frequently) Check for new changes on the remote repository

git pull --rebase (No conflicts)

Case 1 - Already up to date
Already up to date

Case 2 - Downloading changes without conflicts
Downloading changes

git pull --rebase (Conflicts)

Rebase conflict

Resolve conflicts in text editor

Before
Conflict in text editor - before

After
Conflict in text editor - after

OR

Resolve conflicts in VisualStudio

Conflict in visual studio - before

Conflict in visual studio - after

git add path_to_file/filename.extension

git add path_to_file/filename.extension

git rebase --continue

git rebase --continue

4. When feature is finished -> squash

git rebase -i

git status - 3 commits

interactive rebase

Commits before editing pick

Squash commits squash

Commit message before editing commit messages - before

Changed commit message commit messages - after

squashed commits

5. When feature is finished -> push

git push origin HEAD

WARNING: If you have to use --force
use: git push origin HEAD --force-with-lease

git push origin HEAD

6. Pull request

Create a pull request in accordance with the guidelines on: Branching policy

Select the appropriate base branch

Create Pull Request

Correct branches

7. Merge

When your pull request is approved by the appropriate number of people, do the merge according to the guidelines on: Branching policy

8. Delete useless branch

Remote branch

Delete branch after merge

OR

Standard way to delete remote branch step1

Standard way to delete remote branch step2

Local branch
git checkout master

git checkout master

git pull --rebase

git pull --rebase

git branch -D feature/feature-name

git branch -D feature/feature-name

⚠️ **GitHub.com Fallback** ⚠️