Configuration
Name & Email
$ git config --global user.name {username}
$ git config --global user.email {email}
SSH Key
Enter “~/.ssh” directory, execute:
$ ssh-keygen -t rsa -C "your.email@example.com" -b 4096
Add SSH key on the github website.
Git Operations
Pull
-
Create a new folder as the local workspace, enter the folder and execute:
$ git init
-
Connect the local repo with the corresponding branch using ssh address:
$ git remote add origin {ssh-address}
-
Pull the branch to the local:
$ git pull origin {remote-branch}:{local-branch} # for example: $ git pull origin local-origin
-
Done.
Push
-
Check the status of files in the local:
$ git status
-
Add modified file to staging area:
$ git add -A . # add all files $ git add {folder/file} # add specific file(s)
-
Commit to the local repository:
$ git commit -m "{comments}"
-
Synchronize the previous version and rebase, in order to make sure there will not be conflicts when merging the branch with the remote origin. If there are conflicts in the rebase process, they should be solved.
$ git fetch origin {origin-branch} $ git rebase origin/{origin-branch}
-
Push to the personal remote branch:
$ git push origin {local-branch}:{remote-dev-branch}
-
Submit a merge request to merge with the remote origin.