Editing Git help

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
== autocompletion ==
== Merging Branches ==
 
http://stackoverflow.com/questions/9550447/is-there-a-shortcut-for-git-branch-name
 
<source>
# centos/rhel
wget https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -O ~/.git-completion
emacs ~/.bash_profile
source ~/.git-completion
</source>
 
 
 
 
== cherry-pick ==
 
* http://wiki.koha-community.org/wiki/Using_Git_Cherry_Pick
 
Example:
* Source Branch: dev  ( what we want to cherry pick from )
* Target Branch: test
<source>
# checkout your target branch ( the branch you want to merge into )
git checkout test
 
# create a new branch -- easier to redo mistakes ( delete branch and start over )
git branch test-cp
 
# find commits you want to cherry-pick ( in this case we are cherry picking from "dev")
git log --pretty=oneline dev
 
# pick commits from bottom to top ( repeat for all commits)
git cherry-pick "hash"
 
# check results
git diff test..test-cp
 
# if you are happy with results
git checkout test
git merge test-cp
git push
</source>
 
 
 
 
== Branches ==
 
=== create ===
<source>
git checkout branch
git branch newbranchname
git checkout newbranchname
</source>
 
=== pushing ===
<source>
git checkout newbranchname
git push origin newbanchname
</source>
 
=== deleting ===
<source>
git branch -D newbranchname
git push origin :newbranchname
</source>
 
=== Merging ===


http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging


==== Merging Dev -> Master ====
=== Merging Dev -> Master ===
* Will checkout the 'master' branch and merge from the 'dev' branch. Any applicable changes within 'dev' will be in 'master' once this command has completed.
* Will checkout the 'master' branch and merge from the 'dev' branch. Any applicable changes within 'dev' will be in 'master' once this command has completed.


Line 80: Line 13:




==== Merging Master -> Dev ====
=== Merging Master -> Dev ===
* Will checkout the 'master' branch and merge from the 'dev' branch. Any applicable changes within 'dev' will be in 'master' once this command has completed.
* Will checkout the 'master' branch and merge from the 'dev' branch. Any applicable changes within 'dev' will be in 'master' once this command has completed.


Line 87: Line 20:
git merge master
git merge master
</source>
</source>
==== Selective Merge - Patches ====
* merging 'mybranch' with updates from 'master'
<source>
git checkout mybranch
git branch merge_master_mybranch_patch
git checkout master
git diff --no-prefix mybranch > mybranch.patch
</source>
* Edit the mybranch.patch to your needs.. excluding changes you do not want from master
* When you are ready to patch - checkout your branch 'mybranch' to patch
<source>
git checkout merge_master_mybranch_patch
patch -p0 < mybranch.patch
git commit -am 'merge master with mybranch.patch'
git push
</source>
* Now if you are happy with the changes.. lets actually merge the changes with your branch
<source>
git checkout mybranch
git merge merge_master_mybranch_patch
git push
</source>




== Syncing a Forked Repo ==
== Syncing a Forked Repo ==
* https://help.github.com/articles/syncing-a-fork
* https://help.github.com/articles/syncing-a-fork
* http://robots.thoughtbot.com/post/5133345960/keeping-a-github-fork-updated
 
===The Setup===
===The Setup===


Line 154: Line 52:


There are two steps required to sync your repository with the upstream: first you must fetch from the remote, then you must merge the desired branch into your local branch.
There are two steps required to sync your repository with the upstream: first you must fetch from the remote, then you must merge the desired branch into your local branch.
https://github.com/emesene/emesene/wiki/GitHowTo
=== Just reset from Head ===
<source>
git fetch upstream
git checkout master
git reset --hard upstream/master 
git push origin master --force
</source>


====Fetching====
====Fetching====
Line 222: Line 110:
#  1 file changed, 3 insertions(+), 2 deletions(-)
#  1 file changed, 3 insertions(+), 2 deletions(-)
</source>
</source>
=== checkout upstream ===
<source>
git checkout -b upstream upstream/master
</source>




Line 241: Line 122:
git pull
git pull
git push
git push
</source>
== Tags (releases) ==
=== Create ===
<source>
git checkout <branch>
git tag -a v0.0.17 -m "plexWatch v0.0.17 Release"
git push --tags
</source>


== Tags ==
=== Delete ===
=== Delete ===
<source>
<source>
Please note that all contributions to RARForge may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see RARForge:Copyrights for details). Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)