Difference between revisions of "How To Use Gitlab Push, Pull And More"
Jump to navigation
Jump to search
Faiz.kwong (talk | contribs) |
Faiz.kwong (talk | contribs) |
||
| Line 15: | Line 15: | ||
1. First, config your git credential: | 1. First, config your git credential: | ||
| − | git config --global user.name “John Doe” // Follow your Gitlab username | + | ~ git config --global user.name “John Doe” // Follow your Gitlab username |
| − | git config --global user.email johndoe@valse.com.my // Follow your Gitlab email/valse email | + | ~ git config --global user.email johndoe@valse.com.my // Follow your Gitlab email/valse email |
Click enter. | Click enter. | ||
| Line 25: | Line 25: | ||
</gallery> | </gallery> | ||
| − | git clone [URL of the git project] | + | ~ git clone [URL of the git project] |
| − | Example: git clone https://gitlab.com/valsetech/blinq-fashion-web/tree/develop.gitlab | + | Example: ~ git clone https://gitlab.com/valsetech/blinq-fashion-web/tree/develop.gitlab |
For your project depends on the url in gitlab(check from Gitlab). | For your project depends on the url in gitlab(check from Gitlab). | ||
Click enter. | Click enter. | ||
| Line 32: | Line 32: | ||
3. Then go to project repository folder(Still use the Git Bash): | 3. Then go to project repository folder(Still use the Git Bash): | ||
The command for opening project repository inside Git Bash check below | The command for opening project repository inside Git Bash check below | ||
| − | cd blinq-fashion-web // This is for example, follow your project repository name. | + | ~ cd blinq-fashion-web // This is for example, follow your project repository name. |
Click enter. | Click enter. | ||
| Line 45: | Line 45: | ||
Member-section is for all member(can pull from this section). | Member-section is for all member(can pull from this section). | ||
Command for switching to 'develop' branch at below | Command for switching to 'develop' branch at below | ||
| − | git checkout develop | + | ~ git checkout develop |
Click enter. | Click enter. | ||
5. Then create new branch, let call this branch “member-section”: (you can do this in Git Bash or Atom) | 5. Then create new branch, let call this branch “member-section”: (you can do this in Git Bash or Atom) | ||
| − | git checkout -b member-section | + | ~ git checkout -b member-section |
Click enter. | Click enter. | ||
6. Publish this branch so that other member can also access it: | 6. Publish this branch so that other member can also access it: | ||
| − | git push --set-upstream origin member-section | + | ~ git push --set-upstream origin member-section |
Click enter. | Click enter. | ||
7. When you finish a feature and '''want to merge with latest code''', please do: | 7. When you finish a feature and '''want to merge with latest code''', please do: | ||
| − | git pull origin develop | + | ~ git pull origin develop |
Click enter. | Click enter. | ||
Then: | Then: | ||
| − | git push | + | ~ git push |
Click enter. | Click enter. | ||
Revision as of 08:09, 23 August 2019
START HERE :
1. Open Git Bash
- We assume that you have Gitlab account and have install Git.
- Open Git Bash. Do all these in Git Bash command prompt:
Example with picture below
- The command for Git Bash:
1. First, config your git credential: ~ git config --global user.name “John Doe” // Follow your Gitlab username ~ git config --global user.email johndoe@valse.com.my // Follow your Gitlab email/valse email Click enter.
2. Then checkout git repository of our project(in Gitlab): Example with picture at below
~ git clone [URL of the git project] Example: ~ git clone https://gitlab.com/valsetech/blinq-fashion-web/tree/develop.gitlab For your project depends on the url in gitlab(check from Gitlab). Click enter.
3. Then go to project repository folder(Still use the Git Bash): The command for opening project repository inside Git Bash check below ~ cd blinq-fashion-web // This is for example, follow your project repository name. Click enter.
4. Then switch to “develop” branch(Still use the Git Bash):
There is more than 1 branches. Master Branch is for the lead developer. Develop Branch is for developer. Member-section is for all member(can pull from this section). Command for switching to 'develop' branch at below ~ git checkout develop Click enter.
5. Then create new branch, let call this branch “member-section”: (you can do this in Git Bash or Atom) ~ git checkout -b member-section Click enter.
6. Publish this branch so that other member can also access it: ~ git push --set-upstream origin member-section Click enter.
7. When you finish a feature and want to merge with latest code, please do: ~ git pull origin develop Click enter.
Then: ~ git push Click enter.
2. To Push Using Atom IDE
- To push project into Gitlab using Atom, need to open Atom > File > Add project folder > Search your project inside Repository. Picture at below
- You need to click the file.php to stage the project. Picture is below
- You need to stage all file before commit to your branch. After stage all, write something inside commit message, saying that you have commit to the 'name of your branch'.
// Make sure you commit to the right branches. Below tab there is LiveReload - UFT-8 - PHP. Beside the PHP is the category of branch that were connected to your gitlab project.
- To push you have to right-click 'fetch' between of branch and GitHub. After you right-click the 'fetch', you will see more function such as Push, Pull and etc. After you click 'Push' you can view/check at Gitlab under name of your branch, search the folder that you push.