Skip to content

Latest commit

 

History

History

git

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Git

Table of contents

  • Identity
  • Credentials
  • General commands
  • Add files, create commit, and send modifications
  • Branch
  • Synchronize files
  • Merge
  • Pull request
  • References


Identity

git config --global user.name "Nickname"
git config --global user.email [email protected]


Credentials

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.



General commands

# Help command...
git help <verb>
git help config

# Status...
git status
git log
git log --oneline --decorate

# Get branch list
git branch 


Add files, create commit, and send modifications

git add .
git commit -m "Updates"
git push


Branch

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

Synchronize files

git pull

# or...

git pull origin name_of_branch

Merge

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

Pull Request

Steps:

  • fork repository
  • clone repo, and apply modifications
  • Go to the cloned project settings, and send the Pull Request.


Refences