Table of contents
- Identity
- Credentials
- General commands
- Add files, create commit, and send modifications
- Branch
- Synchronize files
- Merge
- Pull request
- References
git config --global user.name "Nickname"
git config --global user.email [email protected]
git config --global credential.helper store
Note: When you clone a repository, and run the push command, you will be prompted for credentials only once.
Note: As for Github, you must first generate an Access Token, currently at: Settings > Developer settings > Personal access tokens.
# Help command...
git help <verb>
git help config
# Status...
git status
git log
git log --oneline --decorate
# Get branch list
git branch
git add .
git commit -m "Updates"
git push
Create new branch:
git branch name_of_branch
Switching Branches:
git checkout name_of_branch
Create a new branch and switch:
git checkout -b name_of_branch
Send local branch to remote:
git add .
git commit -m "Updates"
git push --set-upstream origin name_of_branch
Rename branch:
git branch --move name_of_old_branch name_of_new_branch
git push --set-upstream origin name_of_new_branch
Delete branch:
git push origin --delete name_of_branch
git pull
# or...
git pull origin name_of_branch
Change to branch and apply the merge:
git checkout master
git merge name_of_branch
Merge conflicts:
<<<<<<< HEAD:index.html
<div id="footer">contact : [email protected]</div>
=======
<div id="footer">
please contact us at [email protected]
</div>
>>>>>>> iss53:index.html
Change the part to one of the merge and then commit the changes:
<div id="footer">
please contact us at [email protected]
</div>
Send modifications:
git add . ; git commit -m "Updates"; git push
Steps:
- fork repository
- clone repo, and apply modifications
- Go to the cloned project settings, and send the Pull Request.