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

Quick tip Ctrl+3

There are shortcuts for Flash Builder common features but Project-->Clean... isn't one of them. Eclipse has an interesting Keyboard Shortcut in CTRL+3 - Quick Access. The Quick Access shortcut allows you to hit the shortcut then just start typing the name of the feature you want to use - and there is a big list available to you in Eclipse. A bonus to the Quick Access shortcut is that the last feature you used can be used by hitting return. So to set up a shortcut for Project-->Clean there are just a couple steps.

nomouse1.png

So lately I've been teaching myself how to use the Vim editor. If you know anything about Vim you know it is all about efficiency of keyboard usage. The more I've used Vim, the more I don't want to move my hand to my mouse if I don't have to. It's not that I'm lazy, I just want to challenge myself to be more efficient. If you've been reading my blog lately you may have read about me using embedded fonts via Resource Bundles. One problem I've always had with embedded fonts in Flash Builder is that some builds they work and some they don't. I'm guessing its part of the incremental compilation process because doing a Project-->Clean... seems to fix the problem. It works but then I have to move my hand all the way over to my mouse to make it happen. I needed to find a good keyboard shortcut, for some reason I wanted it to be a default key binding.

Enter CTRL+3

There are shortcuts for Flash Builder common features but Project-->Clean... isn't one of them. Eclipse has an interesting Keyboard Shortcut in CTRL+3 - Quick Access. The Quick Access shortcut allows you to hit the shortcut then just start typing the name of the feature you want to use - and there is a big list available to you in Eclipse. A bonus to the Quick Access shortcut is that the last feature you used can be used by hitting return. So to set up a shortcut for Project-->Clean there are just a couple steps.

  1. Hit Ctrl+3
  2. type 'Clean...' then press enter

Now you can trigger a Project-->Clean... with just Ctrl+3 and Enter. The default for me is to clean all projects and I usually only have one project open at a time so I just enter through that as well.

Really, you can use this with just about any feature you'd like. Once you use it, the feature goes into your Quick Access list. Then its as easy as an arrow up or down (or a few keystrokes to type the action name) to get the feature back to the top of your list and use it.

For me this is one of the hidden gems of Flash Builder. You get this for free for using Eclipse. There's plenty more where that came from too. Are there some hidden gems you use all the time? Please share them in the comments below. Flash Fridays are all about sharing knowledge with the community so that we become better developers.

Read More