Understanding Git

Here are some web references for git usage:

kernel.org/pub/software/scm/ … anual.html


gnome.org/~federico/news-200 … with-git-1
gnome.org/~federico/news-200 … with-git-2


Also here is my .git/config file:
genete-config.txt (776 Bytes)

And the instructions I followed to migrate from svn to git (including the branches at repo.cz - dooglus git repo-):
git-migration-zelgadis.txt (5.92 KB)

Finally a guide from my own:

1) If you regularly will do commits you’ll probably want to become a synfig project member at sourceforge. If you aren’t, please register to SF and ask us to give you write permit to the code.
2) Other wise if you just want to send us some patches you only need to clone the repository, do your changes and create a diff file.
3) Clone the repo:

carlos@pcnuevo:~/Software/test$ git clone ssh://genete@synfig.git.sourceforge.net/gitroot/synfig Initialized empty Git repository in /home/carlos/Software/test/synfig/.git/ genete@synfig.git.sourceforge.net's password: remote: Counting objects: 32972, done. remote: Compressing objects: 100% (8980/8980), done. remote: Total 32972 (delta 24420), reused 32073 (delta 23654) Receiving objects: 100% (32972/32972), 15.12 MiB | 214 KiB/s, done. Resolving deltas: 100% (24420/24420), done.
Replace ‘genete’ with your user name at sf.net.

At this point you’ll have all the remote branches plus a local branch ‘master’ that is pointing to the remotes/origin/master branch. The rest of remote branches are development ones.
Check them all with:

carlos@pcnuevo:~/Software/test$ cd synfig carlos@pcnuevo:~/Software/test/synfig$ gitk --all
In the menu select: File-> List of References

Also you can verify the content of the configuration file at ‘synfig/.git/config’

This is the initial config file: [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = ssh://genete@synfig.git.sourceforge.net/gitroot/synfig fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master
4) Add your local branches that tracks remote ones.
Imagine that you want to develop a new branch based on one remote existing one.

Run git gui. But don’t run it from a console. Run it from the menu. It would prompt the password in a small window instead in the console. I was crazy until I realized that it was waiting for my password in the console :slight_smile:
Then in git gui select Branch->Create. It would prompt a dialog window like this:

See how I inserted the branch name (‘my_branch’) and selected to track a remote branch, in this case remotes/origin/master.
Once created and with the options like the image above you’ll be with ‘my_branch’ checked out.

Now let’s examine the config file:

[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = ssh://genete@synfig.git.sourceforge.net/gitroot/synfig fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [branch "my_branch"] remote = origin merge = refs/heads/master
As you can see there is a new entry telling that ‘my_branch’ is tracking the remote master branch.
It is a bad example beacuse for that type of modifications (straightforward onto the master branch) you don’t need a branch because you already have your local ‘master’ branch created automatically.

The equivalent command of the steps above is:

carlos@pcnuevo:~/Software/test/synfig$ git branch --track my_branch2 origin/master Branch my_branch2 set up to track remote branch refs/remotes/origin/master. carlos@pcnuevo:~/Software/test/synfig$
5) More branches for large modifications.
Maybe you need to do a lot of commits before to have a stable version of your fix or added feature. To do that it is better to create a remote branch and track it locally and keep it safe remotely. Once you are happy with your modifications you can merge (or rebase the pending on the situation you are) your branch with the master one, and incorporate your changes to the main line.

Checkout the base branch:

$ git checkout master

Create a branch

$ git branch genete_test

Checkout it

$git checkout genete_test

Fetch your current branch to the repo. It will create a remote tracking branch.

$git push origin genete_test

Notice how used ‘origin’. This means: push my local branch “genete_test” to remote server identified as “origin” in the config file

The current code:

[code]carlos@pcnuevo:~/Software/test/synfig$ git branch

  • genete_test
    carlos@pcnuevo:~/Software/test/synfig$ git branch genete_test2
    carlos@pcnuevo:~/Software/test/synfig$ git push origin genete_test2
    genete@synfig.git.sourceforge.net’s password:
    Total 0 (delta 0), reused 0 (delta 0)
    To ssh://genete@synfig.git.sourceforge.net/gitroot/synfig
  • [new branch] genete_test2 -> genete_test2
    carlos@pcnuevo:~/Software/test/synfig$ [/code]
    Now do some code modifications:

carlos@pcnuevo:~/Software/test/synfig$ cd autobuild carlos@pcnuevo:~/Software/test/synfig/autobuild$ ls api.sh trunk carlos@pcnuevo:~/Software/test/synfig/autobuild$ gedit api.sh carlos@pcnuevo:~/Software/test/synfig/autobuild$ git commit -a Created commit 38db89b: Test commit 1 files changed, 1 insertions(+), 1 deletions(-)
And push your commits to the remote branch

carlos@pcnuevo:~/Software/test/synfig/autobuild$ git push sf genete_test2 genete@synfig.git.sourceforge.net's password: Counting objects: 7, done. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 369 bytes, done. Total 4 (delta 2), reused 0 (delta 0) To ssh://genete@synfig.git.sourceforge.net/gitroot/synfig f869a45..38db89b genete_test2 -> genete_test2
Once you finish your modifications in your development branch you can merge it to master

$ git checkout master $ git merge genete_test2 $ git push
(obviously I won’t do it in real life like the previous examples)
And you’re done.

I hope all this mess help someone.

Git Cheat Sheet: cheat-sheets.org/saved-copy/ … -sheet.pdf


I work with atlassian git in my Mac. :mrgreen:

In git, i’m working on d-j-a-y / synfig forked from synfig/synfig ,
have done microscopic change (commented a function), commit it and push it …
Now i want to copy d-j-a-y / synfig change to synfig/synfig in order to get last synfig/synfig change and follow…

Sure it’s easy, but want to do it the right way … .how to ?

Can I see you remote repository?

github.com/d-j-a-y/synfig added you as collaborator

So you have made a commit on the master branch. Usually you should start your own branch from master to be possible to work on more than one feature at a time. Anyway in your case you have to do a pull request for your branch. I would receive that pull request and if applicable I would incorporate it to Synfig master branch.

Ok i have found … was not so hard finally with well choosed keywords

update a github fork from the original repo
bradlyfeeley.com/2008/09/03/upda … inal-repo/
Take also a look in comments… some are instructive.

git remote add --track master msynfig https://github.com/synfig/synfig.git git remote git fetch msynfig git merge msynfig/master

and little gitk to see graphicly what’s happen .

Hi, djay! As genete noted, you need to go to GitHub web UI and send a pull request from your master barnch to the main synfig repo. :slight_smile:


Z>Whats i have done seems to result the same … no ?

Maybe I misunderstood your question.

If you want to get the latest changes from synfig/synfig to your latest repo, then your steps are exactly right:

git remote add --track master msynfig https://github.com/synfig/synfig.git   (you need that only once!!!)
git fetch msynfig

… but instead of “git merge msynfig/master” I recommend to do “git rebase msynfig/master”. That way the history tree will be cleaner.

BUT, if your question is how to get the changes from your repository to synfig/synfig, then you have to use pull requests (see above). :slight_smile:

Welcome to LearnGitBranching! / pcottle.github.io/learnGitBranching/

This application is designed to help beginners grasp the powerful concepts behind branching when working with git. We hope you enjoy this application and maybe even learn something!

If you have not seen the demo, please check it out here:


Annoyed at this dialog? Append ?NODEMO to the url to get rid of it, linked below for convenience:


----BigUp René.M who share me that link—