[Gambas-user] IDE support for git (was: Feature request: Option to create .gitignore in new Project dialog)

Tobias Boege taboege at ...626...
Fri May 16 18:57:12 CEST 2014


On Fri, 16 May 2014, Patrik Karlsson wrote:
> 2014-05-15 12:26 GMT+02:00 Beno??t Minisini <gambas at ...1...>:
> 
> > Le 09/05/2014 16:16, Patrik Karlsson a ??crit :
> > > I think it would be nice to just tick a CheckBox in the new project
> > dialog
> > > to create a standard .gitignore.
> >
> > Better: the IDE should support git as it supports subversion.
> >
> > Do you have the needed knowledge to explain me the difference between
> > git and subversion, and how I can do with git what I'm already doing
> > with subversion? (updates, commits, conflict management, revision
> > numbers, ignoring files...)
> >
> > --
> > Beno??t Minisini
> >
> 
> I guess I don't.
> I'm not sure how Gambas support for subversion is, I have never used it.
> In NetBeans and Eclipse I have used integrated svn and integrated git and
> if Gambas could provide that it would be really cool.
> For me, the main advantage that git has over svn is well, speed, and the
> fact that it is distributed. I can work on my local copy and commit even
> when not online, and later push/sync with another repository.
> 

Personally, I use git for everything that is not Gambas - but not
professionally. I only know what I needed up to the present.

1. Repository creation
----------------------

Differences begin with repository creation. In git, a repository is
(simplified) a directory hierarchy and nothing more - unlike svn where a
repository is p.d. bound to a central server.

In the IDE project creation wizard, when the project is given the name
"myproject", you would create the repository using

$ git init /path/to/myproject

2. Adding, removing, committing
-------------------------------

Adding, removing and commiting is a little more difficult. Git knows the
modifications you did to the local files but it requires you to explicitly
choose the pieces you want to commit. That is done using

$ git add file_to_commit

which adds the file to the staging area (the stuff that will be committed on
next commit). You can remove files again from the staging area using

$ git reset HEAD file_to_unstage

If you are ready, do

$ git commit

and you are prompted to enter a commit message (which can be given from
outside using the -m switch).

HOWEVER, git allows that you only have some parts of a modified file in the
staging area and some not. There were times I needed that feature to make
orderly commits. I think we can leave this out for now.

3. Updates
----------

If you have a remote origin of your project,

$ git push

will update that remote repository. Conversely,

$ git pull

will pull in changes from the remote origin. Again, here is much more to
explore and support...

4. Conflicts
------------

Conflicts are likely to pop up in merges ("pull" above is also a merge). If
a merge brings conflicts, it is stopped. You are shown the conflicting files
which include conflict markers. You then resolve the conflicts and add them
to the staging area. The merge is continued when you commit.

5. Miscellaneous
----------------

You can ignore files by providing a .gitignore file. It lists patterns for
files to be ignored.

Revision numbers aren't in git. Every commit has a SHA-1 hash that
identifies it.

A central point in working with git is "branching, merging, rebasing". We
could use support for that, too. But I have no idea about the current IDE's
treatment of VCS's so I don't know how these things would integrate into the
interface... and maybe this point has time until basic functionality is
ready.

If you have questions (specific ones at best, a la "here's the SVN command,
how to do it in git?"), don't hesitate.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list