- --local local to that repository only
- --global global to that machine
Set email
git config --global user.email "mail@example.com"`
Set username
git config --global user.name "your_user_name"
Automatically prune during fetch/pull
git config remote.origin.prune true
https://github.com/[username]/[repository-name].git
git clone https://github.com/[username]/[repository-name].git
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/[username]/[repository-name].git
git push -u origin master
git remote add origin https://github.com/[username]/[repository-name].git
git push -u origin master
- -b if not exists create a new one
git checkout -b [branch name]
- -a local
- -r remote
git branch -a
git fetch --all --prune
git checkout [branch name]
git checkout [main branch]
merge another branch to master 1.--no-ff keep track who did the merge 2. Add an optional commit message using this commands
git merge --no-ff [branch name]
git diff branch_1...branch_2
- -d means
--delete
only deletes the branch if it has already been fully merged in its upstream branch - -D means
--delete --force
deletes the branch irrespective of its merged status
git branch -d branch_name
git branch -D branch_name
or
git push <remote_name> :<branch_name>
Ex. git push origin :branch-name-to-delete
Then use sync command to update branch list with remote.
undo last commit
git reset HEAD~
remove all local commit
git reset --hard origin/<branch-name>
press "i"
write your merge message
press "esc"
write ":wq"
then press enter
shows SHA1 id and branch names
git remote --heads origin
follow this instruction step by step