mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Update git-101.md
Add info about sync scenario [skip ci]
This commit is contained in:
@@ -44,3 +44,35 @@ changes, and issue a pull request.
|
||||
|
||||
[Githug](https://github.com/Gazler/githug) is a great gamefied way to learn git in couple hours.
|
||||
After finishing 50+ real-world scenarios you will have a pretty good idea about what and when you can do with git.
|
||||
|
||||
|
||||
## Scenarios
|
||||
|
||||
#### Sync your local repo
|
||||
|
||||
Don't commit your changes directly to master.
|
||||
It would make workflow messy.
|
||||
|
||||
Always create a branch for your changes.
|
||||
|
||||
```sh
|
||||
# switch to master branch
|
||||
|
||||
# fetch updates all remote branch references in the repo and all submodules
|
||||
# --all : tells it to do it for all remotes (handy, when you use your fork)
|
||||
# -p : tells it to remove obsolete remote branch references (when they are removed from remote)
|
||||
git fetch --all -p
|
||||
|
||||
# pull updates your local files
|
||||
# you should call this command ONLY from master branch
|
||||
git pull origin master
|
||||
|
||||
# update submodules
|
||||
git submodule update --recursive
|
||||
```
|
||||
|
||||
Then switch to your branch and do rebase
|
||||
|
||||
```
|
||||
git rebase master
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user