Useful shortcuts for vi editor

Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Sunday, 13 September 2020

A basic git exercise

e.g. an example with basic git commands 
source: develop branch 
target: private branch (not exist on the git local/remote repository at the begin)

1st step:
$ git clone http://blabla --branch develop
-- cloning develop branch data on the local machine

2nd step:
git branch private
-- defining a new branch as "private" on the local repository

3rd step:
git checkout private
-- switching the active/using branch to "private" on the local repository

4th step:
make your changes on the files/folders

5th step:
git status
-- see the summary that what you changed on the local repository

6th step:
git diff
-- see the differences between local repo and remote repo

7th step:
$ git add --all
-- add all modified files from (local) working directory to git staging area

8th step:
$ git commit -m "my latest changes applied on the code"
-- save your changes to the local repository to be ready for git push

9th step:
$ git push --set-upstream origin private
-- push all changes to the (remote) git repository by defining a new remote branch as the same local branch name; origin private

That's all!

Difficulty level:
Low

Monday, 30 September 2019

How to solve git merge conflict?

e.g. git merge conflict issue
source: private branch
target: develop branch

1st step:
$ git clone http://blabla --branch private

2nd step:
$ cd <working folder>

3rd step:
$ git checkout private
-> if not specified branch by default while cloning branch

4th step:
$ git merge develop

Error occurred in here
Auto-merging my_new_file.yml
CONFLICT (content): Merge conflict in my_new_file.yml
Auto-merging my_new_file.yml
Automatic merge failed; fix conflicts and then commit the result.

5th step:
-> make necessary changes on my_new_file.yml

6th step:
$ git status
-> check the file

7th step:
$ git branch
-> check the branch before commit

8th step:
$ git add --all

9th step:
$ git commit -m "blabla"

10th step:
$ git push