Fast-Forward Merge
Duration: 3 minutes
Based on:
1. Set-Up
1.1 Open PowerShell window
1.2 Restore state from backup copy
Copy the code, right-click in PowerShell window to paste it and press Enter to execute
cd ~/Documents/git-workoutsCopy-Item bak-2.1 current -Recurse -Forcecd current2. Make first commit
2.1. Switch into branch
Type in PowerShell prompt and press Enter to execute
git switch groups2.2 List branches
Type in PowerShell prompt and press Enter to execute
git branch
2.3 Create file
Type in PowerShell prompt and press Enter to execute
New-Item groups.md2.4 Stage changes
Type in PowerShell prompt and press Enter to execute
git add -A2.5 Commit changes
Type in PowerShell prompt and press Enter to execute
git commit -m "Add groups.md"3. Make second commit
3.1 Add content into the file
Type in PowerShell prompt and press Enter to execute
Set-Content -Path "groups.md" -Value "# Groups"3.2 Stage changes
Type in PowerShell prompt and press Enter to execute
git add -A3.3 Commit changes
Type in PowerShell prompt and press Enter to execute
git commit -m "Add title into groups.md"3.4 View commit history
Type in PowerShell prompt and press Enter to execute
git log --oneline
4. Merge changes into master
4.1 Switch into master branch
Type in PowerShell prompt and press Enter to execute
git switch master4.2 View commit history
Type in PowerShell prompt and press Enter to execute
git log --oneline
4.3 Merge changes
Type in PowerShell prompt and press Enter to execute
git merge groups
4.4 View commit history
Type in PowerShell prompt and press Enter to execute
git log --oneline
4.5 Delete branch
Type in PowerShell prompt and press Enter to execute
git branch -d groupsAdditional Info
Note that you cannot delete an active branch in Git.
To delete a branch, you must first switch to another branch (make it active).
For example, to delete the groups branch, you need to switch to the master branch first.
4.6 List branches
Type in PowerShell prompt and press Enter to execute
git branch
5. Wrap-Up
5.1 Make backup copy
Copy the code, right-click in PowerShell window to paste it and press Enter to execute
cd ..Copy-Item current bak-2.2 -Recurse -ForceRemove-Item current -Recurse -Force