duogbachdev / LearnGit

Home Page:https://duogbachdev.github.io/LearnGit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LearnGit by DuogBachDev

Git Github Flow Mind Map

Case 1 : You are the project owner

Step 1 : Project Initialization

- Initialize the project on the machine first and then add the remote from github

echo "# LearnGit by DuogBachDev" >> README.md
git init
git add .
git commit -m "Project_Initialization"
git remote add origin https://github.com/...
git push origin master

Step 2 : Checkout new branch

- Stand from master branch and then switch to new working branch

git checkout -b "New_Working_Branch"

Step 3 : Change & commit code

- Add features or modify the code in the project

- Add all new code

git add .

- Generate commit code

git commit -m "First_Commit"

Note : If you have already committed with a commit name and want to modify that commit name, you can use the command

git commit --am -m "New_Commit_Name"

Step 4 : Push the code to github

- For the repository that you own, just push straight to the main branch or the branch you switched to the new branch

git push origin "Branch_Name"

- Create a pull request & compare

Step 5 : Review and update commit

- In case after you have created a pull request and you want to edit it, you need the next code, then use the command

git add .
git commit --amend
git push origin "Branch_Name" -f

Step 6 : Merge pull resquest

- Merge pull request from master branch

git checkout "Master_Branch"
git pull origin "Master_Branch"

- Delete branch on github and local

1. Local :
git branch -D "Branch_Name"

2. Github :
Click the delete branch button on the github page

- Then go back to step 2 and continue for the project

Note : Note for corporate projects, depending on the company, if you are decentralized, you can merge the code, otherwise the leader will do this.

Case 2 : The project belongs to a certain company or organization

For example company name is : DuogBachDev

Step 1 : Project Initialization

- Folk project on personal github

Click the folk button on the project's display page

- Clone folk project to my computer

git clone https://github.com/...

- Add master remote from company repository

git remote add "Company_Name" https://github.com/...

Step 2 : Checkout new branch

- Stand from master branch and then switch to new working branch

git checkout -b "New_Working_Branch"

Step 3 : Change & commit code

- Add features or modify the code in the project

- Add all new code

git add .

- Generate commit code

git commit -m "First_Commit"

Step 4 : Push the code to github

- You need to push commit to your personal remote, not your company remote

git push origin "Branch_Name"

- Open the company's original repository and make a pull request

Step 5 : Review and update commit

- In case after you have created a pull request and you want to edit it, you need the next code, then use the command

git add .
git commit --amend
git push origin "Branch_Name" -f

Step 6 : Merge pull resquest

- Merge pull request from master branch

git checkout "Master_Branch"
git pull origin "Master_Branch"

- Delete branch on github and local

1. Local :
git branch -D "Branch_Name"

2. Github :
Click the delete branch button on the github page

- Then go back to step 2 and continue for the project

Note : Note for corporate projects, depending on the company, if you are decentralized, you can merge the code, otherwise the leader will do this.

Additional

git reflog --no-abbrev, cherry pick..v.v

Final

If you want to be quick, just finish the code and push straight to the master branch for quick (≧∇≦)ノ

Copyright

Author : DuogBachDev aka DuogBachDev

Portfolio : https://portfolio-duogbachdev.vercel.app/

DonateforMe : https://donate-duogbach.vercel.app/

"A bit of fragrance clings to the hand that gives flowers!"

Thanks for watching !

About

https://duogbachdev.github.io/LearnGit/


Languages

Language:Markdown 72.8%Language:JavaScript 27.2%