This gist contains works of other users that I collected in the past but unfortunately I do not have references to them.
echo "# shoppernet" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [repo_url]
git config --global user.name <username>
git config --global user.email <email>
git config credential.helper 'cache --timeout=3600'
git push -u origin master
git branch [branch_name]
git checkout [branch_name]
git push -u origin [branch_name]
git checkout master
git pull [upstream_repo_url] [branch_name]
git pull which does a git fetch followed by a git merge to update the local repo with the remote repo
git commit -m "merging with upstream repo"
git push origin master
To address merge conflicts see below
git branch -d {the_local_branch} (use -D instead to force deleting the branch without checking merged status)
git push origin --delete {the_remote_branch}
git log
git rev-list HEAD | tail -n 1
git log --pretty=format:"%h - %an, %ar : %s"
git config --get remote.origin.url
git reset HEAD~1
git push -f origin master
When you do a git reset HEAD~1, you tell Git to move the HEAD pointer back one commit. This leaves your file modified but unstaged (to return file to previous commit use --hard option)
If you have some local changes and unable to pull from upstream repository, delete your local changes.
git reset --hard origin/master
git tag <tagname>
git tag -a <tagname> -m <tagmessage>
git tag -d <tagName>
git push origin :refs/tags/<tagName>
git push --delete origin <tagName>
git config merge.tool vimdiff
git config merge.conflictstyle diff3
git config mergetool.prompt false
Other tools are meld, opendiff, kdiff3, tkdiff, xxdiff, tortoisemerge, gvimdiff, diffuse, ecmerge, p4merge, araxis, emerge.
git mergetool
In the Terminal:
+----------------------+
| | | |
|LOCAL |BASE |REMOTE |
| | | |
+----------------------+
| MERGED |
| |
+----------------------+
These 4 views are
LOCAL – this is file from the current branch
BASE – common ancestor, how file looked before both changes
REMOTE – file you are merging into your branch
MERGED – merge result, this is what gets saved in the repo
You can navigate among these views using ctrl+w. You can directly reach MERGED view using ctrl+w followed by j.
:diffg RE
:diffg BA
:diffg LO
:wqa save and exit from vi
git commit -m "message"
git clean