The instructions I'm putting here are for use with "linux like" environment under Windows as MSysGit, MinGW or CygWin. (and for any Linux too)
If you want only to translate Wings3D' language files go here: [Translating Wings3D] Working with GitHub
Also, this is not a technical guide (neither detailed) - for that, check these links:
- Git Community Book (user friendly)
- Git Documentation (user friendly)
- git(1) Manual Page (full list of commands)
- Git Internals - Maintenance and Data Recovery
Setting up GitHub
This is a sample what I have on my system (you can use these command at any time):
$ git remote % this will list all remote repositories added
$ git branch % this will list all branches existing on your PC (local)
Starting to work...
These are the basic operations your will use.
Other useful commands...
These are operations that you would need to use.
Added 06/15/2015 - got to link
This small reference was assembled along the time I was starting to contribute with the Wings3D's community.
I would to register my thanks to optigon and dgud which helped me a lot by taking out my doubts (even nowadays).
If you want only to translate Wings3D' language files go here: [Translating Wings3D] Working with GitHub
Also, this is not a technical guide (neither detailed) - for that, check these links:
- Git Community Book (user friendly)
- Git Documentation (user friendly)
- git(1) Manual Page (full list of commands)
- Git Internals - Maintenance and Data Recovery
Setting up GitHub
- Starting
If you still don't have a GitHub account, you will need to create one: link
After you've created your account, don't forget to Generating SSH Keys (help in case of any issue about it)
- Preparing to clone
You will find all Wings3D projects under dgud's repository. (you can fork any other, but that is the official repository)
Find the project you want clone and fork it first.
- Select the repository you want;
- at the top-right the project page you will find the Fork button;
Now, you have a project "copy" in your own repository. Check it out.
You will see a git link that you should use for cloning (e.g.: [SSH] git@github.com:<your git ID>/wings.git).
- Cloning the Wings project repository
Lets say that the project sources will be put under a folder named c:\sources\ and it still empty (at the first time this will be true).
After you start the terminal, enter in the source folder:
$ cd /c/sources
$ git clone http://github.com/<your git ID>/wings.git wings
$ cd wings
This will copy the entire project source code in your PC in c:\sources\wings and set the current directory to wings.
You still need to:- Git records your name and email address with every commit you make, so the first step is to tell Git what these are:
$ git config --global user.name 'Your Name'
$ git config --global user.email you@somedomain.com
- define the remote repository for the main developer (you can define more then this, if you want):
$ git remote add dgud git://github.com/dgud/wings.git
- transfer the remote repository reference/index to your PC
$ git fetch dgud
- Git records your name and email address with every commit you make, so the first step is to tell Git what these are:
This is a sample what I have on my system (you can use these command at any time):
$ git remote % this will list all remote repositories added
Code:
dgud
optigon
origin % this represents your repository
$ git branch % this will list all branches existing on your PC (local)
Code:
dgud/bugfixes
dgud/pu
* master % this one marked with "*" is the current one - that you are working on
mv/ask_addons
mv/bugs1.4.1
origin
rj/preview_dialogs
Starting to work...
These are the basic operations your will use.
- $ git checkout <branch_name>
This will set your current branch for working.
* When you are switching between branches all files changed in the first branch will be replaced for that in the second one.
- $ git checkout -b <your_name_initials>/<your_new_branch>
As your master should not be the branch that you add commits to, this should be used to create a new branch [-b] based on the current one.
* The branch naming was suggested to me by optigon in the past.
- $ git commit -a -m"your commit description"
After you finish your changes (or periodically, if you want) you need to use this command for save them. The description here is single line only. For multi-line you will need to set up the emacs editor for your environment.
* Only after commit your changes you will be able to push your changes to the origin repository (yours).
- $ git push origin <your_branch_name>
This command will sent your branch (new one/updates/changes) to your repository on GitHub.
* Once in the GitHub repository, your can access it on your browse and use the option to pull a request for other member that had forked the same project (not only that one you've made your fork).
Other useful commands...
These are operations that you would need to use.
- Forcing your current branch be replaced with that one in the referenced repository:
$ git reset --hard <repository>/<branch_name>
* Warning: any changes you've made will be lost!
- Showing the commit informations for the current branch (hit [q] to exit):
$ git log
- At any time that you want update reference/index of a remote repository, just use:
$ git fetch <remote_repository>
- If you already have a branch with your changes, but it is based on an older repository, then you can use:
$ git checkout <your_branch_name>
$ git rebase -i <repository>/<branch_name>
* This should update your branch, but preserving your changes.
- To see the remote branches:
$ git branch -r
- Renaming a local branch:
$ git branch -m <old_name> <new_name>
- To remove/delete a branch from your PC (local) repository use:
$ git branch -D <branch_name>
ex. $ git branch -D mv/fix_pov-ray
- To remove/delete a branch from your Github repository use:
$ git push origin --delete <branch_name>
or
$ git push origin :<branch_name>
ex. $ git push origin --delete mv/fix_pov-ray
* it's also possible to remove more than one at time:
$ git push origin :<branch_name_1> :<branch_name_2> :<branch_name_3>
- If added files to the project, you will need to add them to be synchronized with other branches:
$ git add <relative_path_and_file_name>[/i]
ex. $ git add plugins_src/primitives/wpc_heightmap_surface.erl
- Removing the last commit sent to the remote repository:
$ git reset --hard HEAD~1
$ git push -f
- Check the difference between the files you've changed and those previously committed:
$ git diff
- Checking the working tree status:
$ git status
- Verifying various types of objects (usually you will see information about the last commit):
$ git show
- The command gitk will show you (in a graphical UI) the commits history and let you compare different ones
- You can build a different version of Wings3d by using the tags IDs. Use $ git tag -l to get the tags list and then use:
$ git checkout tags/<tag_name>
- You are recreating your local environment and want to "download" your repositories from the github cloud (origin). Fetch origin will not work. What you need to do is create your local repository as usual, plus informing the source repository to be clonned:
$ git checkout -b mv/fix_pov-ray origin/mv/fix_pov-ray
- If you ran make and are getting unexpected error related to lang files, then this command will clean everything up (then run make again):
$ git clean -dfX
- Getting a summary of all commits in your local branch
$ git log --pretty="%h - %s"
Added 06/15/2015 - got to link
- Updating your master branch with the official one
- Fixing the last commit you just pushed to origin
- Copying commits from a branch to another
- Using git to prepare your PR to have a clean history by Maximilian Peters
This small reference was assembled along the time I was starting to contribute with the Wings3D's community.
I would to register my thanks to optigon and dgud which helped me a lot by taking out my doubts (even nowadays).