Coding and Development Daryl Ducharme Coding and Development Daryl Ducharme

Ignoring file changes with git

Here's a quick little post about one of the most useful tricks you can do with git. Often you have files you are working with in a project that you need to track the file for everyone on the project to have but not save your changes to the file itself. For example, project files in eclipse that change how the project uses the files. To have the file in the index but not save the changes, do the following.

  1. do a
    git add 
  2. do a
    git commit
  3. do a
    git update-index --assume-unchanged [FilePath]

Now the file you have told git that any changes you make to the file, it can ignore. There are a couple more notes you might want to know.

  • To stop ignoring changes to the file you can call git update-index --no-assume-unchanged
  • If someone else changes the file in a merge, even if they change it back, you'll have to tell git to ignore it again.
  • Egit, the eclipse git plugin, has this functionality under the advanced section of the team menu.
  • Rebasing always seems to require me to remind git to ignore changes.

This has been a great help for files at work. Actionscript project files like .actionscriptproperties, .project and a developer config file are important to have tracked but helpful to allow untracked changes.

Read More
Flash Friday Daryl Ducharme Flash Friday Daryl Ducharme

Flash Friday - Version Control

When I first started my Flash Friday posts I wanted to write about the whole flash ecosystem. At the time I thought about Flash, Actionscript, Flex, Flex/FlashBuilder and a few other tools. Recently, I have realized that the ecosystem is much larger than just flash. For people to truly be well rounded flash and actionscript developers who make every other flash and actionscript developer look good its important to know about these non-flash things. One of the most important things to any developer is version control. On the surface, version control seems simple enough. Save files in a way that allows me to go back in time if I make a mistake or forgot what I did in the past. Many people, a past version of myself included, think that's all there is to version control and thus us backup folders or file naming conventions to achieve this goal. I am writing this article because version control is way more than just this and definitely more important. For those who really master it you can actually save yourself quite a bit of time.

Why learn version control

If version control is more than backing up files what is it? I'm glad you asked. Version control is a way to safely and elegantly work with multiple people on a project. The multiple people include people in the same office or people on the other side of the world. It also includes the multiple yous that you wish you could create so that you could finish that cool new feature but you just can't take the time to hunker down and get it done all at once.

Version control is and/or allows:

  • Saving a history of your work as it evolves
  • Keeping track of who did what
  • Trying things out that you might throw away
    • Without breaking working code
    • Keeping a history of that as well
  • Working on a file without worrying if somebody else is
  • Taking someone else's work in a different direction ( forking )

What should you learn

  • SVN - The most popular centralized version control system
    • Lots of great tools makes it easier to include artists in the version control system
  • GIT - A very popular up and coming distrubuted version control system
  • Branching and Merging
    • Become a master at this for whichever version control systems you learn and it will make your professional life much simpler.

Tools

  • Subclipse - a great eclipse SVN plugin you can use with Flashbuilder or FDT
  • EGit - a similar eclipse plugin for Git
  • TortoiseSVN/TortoiseGit  - two great sell extensions for version control in Windows explorer.
  • GitHub - If you are working with Git this is a great place to start putting your code. Lots of straightforward how-tos
  • Books - I've found the following two books to be extremely helpful in learning SVN and Git

 

Final Notes

I mentioned SVN and GIT because they are currently in such wide use. However, version control concepts can be learned from any version control system. If your company or project is using something else, such as CVS or Mercurial, learn it and master as much of it as you can. I can't stress enough how important it is to master branching and merging. Get good at this and task switching will be much easier so you'll be able to working on many projects at once.

What are your thoughts on version control? What problems have you had? What successes have you had?

Read More