Git tips: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
 
(24 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{Developers}}
= Create a remote branch =

== Working on branches ==
=== Create a remote branch ===


git clone git+ssh://dev.laptop.org/git/sugar
git clone git+ssh://dev.laptop.org/git/sugar
cd sugar
git branch trial-2
git push origin trial-2
git branch update-1
git push origin update-1


= Work on a remote branch =
=== Work on a remote branch ===


git clone git+ssh://dev.laptop.org/git/sugar
git clone git+ssh://dev.laptop.org/git/sugar
git checkout -b trial-2
git checkout --track -b update-1 origin/update-1
git pull


You can now use commit, push and pull as usual.
Add the following to .git/config


=== Apply changes from master ===
[branch "trial-2"]
remote = origin
merge = refs/heads/trial-2


git-cherry-pick <commit-id>
Then checkout as a local branch:
git push


== Reverting changes ==
git checkout -b trial-2


When you mess up a file and want it back to what it was, cd into the directory and:
You can now use commit, push and pull as usual.

git checkout HEAD -- gridwidget.py

To remove uncommitted changes and reset the project to HEAD:

get reset --hard HEAD

== When you want an activity that sugar-jhbuild does not bring down ==

Read only:

git-clone git://dev.laptop.org/projects/tamtam

If you have commit access:

git-clone git+ssh://dev.laptop.org/git/projects/tamtam

== See also ==

{{:Git/See also}}

[[Category:Git]]
[[Category:HowTo]]
[[Category:Developers]]
[[Category:Software development]]

Latest revision as of 04:55, 2 July 2014

Working on branches

Create a remote branch

git clone git+ssh://dev.laptop.org/git/sugar
cd sugar
git branch update-1
git push origin update-1

Work on a remote branch

git clone git+ssh://dev.laptop.org/git/sugar
git checkout --track -b update-1 origin/update-1
git pull

You can now use commit, push and pull as usual.

Apply changes from master

git-cherry-pick <commit-id>
git push

Reverting changes

When you mess up a file and want it back to what it was, cd into the directory and:

git checkout HEAD -- gridwidget.py

To remove uncommitted changes and reset the project to HEAD:

get reset --hard HEAD

When you want an activity that sugar-jhbuild does not bring down

Read only:

git-clone git://dev.laptop.org/projects/tamtam

If you have commit access:

git-clone git+ssh://dev.laptop.org/git/projects/tamtam

See also