links:: Source Control for Test Automation with Git MOC

3.3 Cloning, Fetching, Merging and Pulling

3.3 Cloning, Fetching, Merging and Pulling

Pasted image 20221229202059.png|500

Pasted image 20221229202905.png|500

Fetching remote maser branch and merging with local working directory:

git fetch
git branch -vv

master f414bfa [origin/master: behind 1] first commit
git merge

Output:

$ git merge
Updating f414bfa..bfb46a1
Fast-forward
 README.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

[!Fast-forward]
a merge from a branch into another, one where the target branch, in our case that is the local master branch, has not diverged from the source branch.

Pulling is applied to master (current) branch only. Other branches are not touched.

We cannot pull any changes if there are any modified files in working directory.

Pasted image 20221229204738.png|500

git stash
git stash list
# output:
# stash@{0}: WIP on master: bfb46a1 Update 2 - remote edit
git stash pop
# this will remove stash from list of stashes and move stashed changes to working directory
$ git stash pop
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   README.md

Pasted image 20221229205938.png|500