git workflow.

For code related discussions and questions
Post Reply
User avatar
Duha
Trained
Trained
Posts: 287
Joined: 25 Mar 2012, 20:05
Location: SPb, Russia

git workflow.

Post by Duha »

It is not guide. It is some links and my practices.

Getting started:
http://try.github.com/
or same course on codeacademy (if you want to have a bage) http://www.codeschool.com/courses/try-git

setup:
https://help.github.com/articles/set-up-git#
You need setup you username and email. (If you skipp --global it will setup current repo. You can have different user name for different repo.)

Global git config is in you home dir. it named ".gitconfig" (windows, linux) Don`t forget to turn show hidden files.
Local config is in .git/config

For linux users I strongly recommend to colorify command line (looks like windows msisgit bash do it itself)
http://cheat.errtheblog.com/s/git

gitk --all Win/Lin/Mac.
Good tool to see branches. And make some changes. (I like to do cherry-pick via it.)
Random picture from internet:
Spoiler:
Console

Code: Select all

git add .
Adds all files in dir to git. Please don`t do it. It is easiest way to add garbage to project. Once I commit 1gb test file :)

Code: Select all

git add <file>
Normal way to add. I call git status before and copy paste names from there.

Code: Select all

git add -i
Incremental add. Context menu will appear. It is very useful when you need to add part of file to commit. I prefer that way because it force to see what you commit. Looking to code before add is very good practice.

Code: Select all

git checkout <branch>
switch to branch

Code: Select all

git checkout <filename>
Drop you changes for specified file.

Code: Select all

git commit -m "Add new feature to project"
Useful shortcut: commits changes with message.

Commiting
You should try to commit as often as possible.
For bug fixes one bug one commit.
For development:
Implement one feature make commit.
Give readable name to commits.

Commiting all changes for day in one big commit is bad.

Good example of commit names: https://github.com/Warzone2100/warzone2 ... its/master


Free GUI tools for git:
msysgit for windows. It looks awful for me. I don`t like it. Console is better.
AptanaStudio3 has git interface. (It is Eclipse with preinstalled plugins. Javascript support.) I think it not hard to find Eclipse plugins.
I just mention that I used personaly. If you have something to add do it.

Feel free to ask questions.
http://addons.wz2100.net/ developer
Originway
Trained
Trained
Posts: 412
Joined: 08 Aug 2012, 06:22

Re: git workflow.

Post by Originway »

are you telling people that do mods to use git or is this for other people making warzone?
once the git storage is deleted then nobody can get it back right?
User avatar
Duha
Trained
Trained
Posts: 287
Joined: 25 Mar 2012, 20:05
Location: SPb, Russia

Re: git workflow.

Post by Duha »

Originway wrote:are you telling people that do mods to use git or is this for other people making warzone?
It is for people who using git.
once the git storage is deleted then nobody can get it back right?
Yes.

git is distributed version control system.

git commit make entry in you local repo. (need to delete it for total anihilation)
git push syncs it with origin repo. (need to delete both for total anihilation)
If some one will do git pull origin he will have his copy of repo. (need to delete them all total anihilation)
http://addons.wz2100.net/ developer
Post Reply