Git

Add my code to my teammate's code using git branch

Naranjito 2022. 7. 12. 14:32
  • Purpose

Add my code to my teammate's code.

 

- My teammate's code

 

- My code

 

- Add my code to my teammate's code.

 
 
  • Step

1. git branch

(In order to merge to the master)

Create branch, default is main.

Once new branch created, it appears below main.

The one with * at the front is the currently selected branch.

% git branch recommend_item

% git branch

>>>

* main
  recommend_item

 

2. switch to the branch

 % git switch recommend_item  
 
>>>
 
Switched to branch 'recommend_item'
Your branch is up to date with 'origin/recommend_item'.

 

3. clone

Clone my teammate's code.

Format example : git clone https://mellamonaranja:PERSONAL_ACCESS_TOCKEN@github.com/illunex/abc_food_api_server.git

 

4. add

Add my code.

 

5. commit

 

6. push

 

tips

- Check occasionally the status, configure.

git status

git config --list

git config

git remote remove origin

ls -al

 

- Working Directory : the directory where my code is

- Staging Area : Space where files are gathered to commit after 'git add'

- Repository : Storage where commits are gathered

 

- Untracked : Compare with my working directory and git, files only in my working directory

- Unmodified : When file is newly added after 'git add'

- Modified : File modified after 'git add'

 

reference : https://iseunghan.tistory.com/322