Is there any way to semi-automatically commit? - windows

Please bear with me here, because I'm a beginner when it comes to version control systems. I've decided to start with the very simple GitHub app. What I want to do is (because I work in Dreamweaver) when I save a file a window to pop-up and ask me if I want to commit, is something like this achievable and if so... then how?

Perhaps there's a solution that uses a directory watcher to watch for changes and then prompt?
In my opinion, this isn't really a good solution though - you don't just want to use Git as a "backup" solution, you want each commit to be a mini-milestone that represents some logical group of changes. I can't think of a single instance where the first time I saved a change to a file it was commit-worthy. If you were to commit with every save, how would you ever test those changes?

I haven't used it myself but the GitWeaver extension may be what you are looking for.

Related

Git is seeing changes I didn't make in xcode

I'm programming in xcode (actually Phone Gap in conjunction with xcode) with git. I'm having a strange issue. When I create two identical branches and try to check out back and fourth between them with out making any changes git is telling me that I need to commit because a change has been made (this same thing is also resulting in merge conflicts). It says the changed file is:
platforms/ios/Butterfli.xcodeproj/project.xcworkspace/xcuserdata/benpearce.xcuserdatad/UserInterfaceState.xcuserstate
Can anyone explain what's going on and how to deal with it.
Yes, .xcworkspaces are simply files that Xcode uses to describe the workspace or projects.
IMHO, There's no need to check these files in at all, unless you share settings with other folks in your projects (and in your case, I suppose other machines that have a user named "benpearce").
In fact, you can safely add them to your .gitignore file.
More info can be seen here

Finding modification date of a file recorded in a CD-R

I need to find out if a file recorded in a CD-R under Windows was modified after its first save. I couldn't find any inspector tools for such a purpose. So I was wondering if there is some kind of Windows API that may be used to extract this information. I found some related questions but answers were too low-level (assembly) and not covering multisession writes.
Thanks.
I don't think this is the place to ask that sort of question.
That said, the best option would be to Right Click > Properties > General Tab. There you should see Created date, Modified date, and Accessed Date. If you are looking for something further than that I'm not aware of any way to see a change log since it's a CD. Also because it is a CD (minus) R you shouldn't be able to write file changes to the cd for changes. That's only a CD (plus) R.
If the file was saved on your computer and you have a regularly scheduled backup, you might be able to find older versions of the file that you can restore to. This is found under the "Previous Versions" tab within Properties.
Hope this helps.

How to keep VS change history after saving?

When one makes a few changes to the code in Visual Studio, then undoes some of them (Ctrl+Z) and then saves the code (Ctrl+S) the whole change history from that point onward (all undone changes) are lost - one can't redo these changes (Ctrl+Y). The history from that point backward is kept by VS but the forward part of it is for an unknown reason dropped.
Any way to keep the whole history?
Use Source control (or local source control on your desktop if that's not feasible), and you can roll backwards or forwards tons of changes, check in more often.
With Git for example I can check in every few minutes and be able to roll back or forward individual lines or commits.
They are using VSS here, so I'm using git for local undo/redo extensions. Source control is the best way to handle more lengthy change histories like you are referring to.
You cannot do anything to make the editor(which maintains the history) save every step you did when you undo some changes and save it. So the answer is NO. I don't know about visual studio 2012 editor though because I haven't used it.
Maybe this extension will help.
http://visualstudiogallery.msdn.microsoft.com/226c2108-9da9-407d-b90d-9783040d27b8

Will adding .xcdatamodel/layout to the .gitignore cause problems?

When using Core Data, Xcode seems to modify the .xcdatamodel/layout file every time I view the data model. I don't want to commit that change because I haven't done anything. Is it safe to add that file to the .gitignore?
In my experiment it was safe. However, I recommend just letting git back it up. The overhead is minimal, so why should this bother you?

What do you do with redundant code?

I have a class, which is part of a code library project that was written for a particular purpose that is no longer required. So the question is what do you do with code like this? Do you simply delete it, or do you leave it in bearing in mind that future developers may come across it and not realise that they can disregard it or do you have some sort of archive system, is there a recognised "pattern" that is in use...
Delete it. You can always get it back from the version control system later. You do have version control, don't you?
As Neil said, delete it. If I'm hired to maintain your project years after you are done with it and it's still full of dead code.. I'm gonna haunt you. And not the ooooohhhhh nice kinda haunting.. but the ARRRRWWWGGGGGRRRR!!!!! annoying kind of haunting.
It depends.
If it is unused because it is obsolete, I would clean it from the current code base by deleting it. If it turns out that it is in fact needed, you can always retrieve it from source control.
If it is unused at the moment, but may be used in the near future, I would keep it in the current code base as I wouldn't expect fellow developers to browse the source control for features just in case. In other words: if you delete something that has a high chance of being used, chances are that someone will re-implement it.
If it is not used anywhere, and no longer required you should delete it to avoid confusion.
You didn't say what code you are using but in C#/VisualStudio you can use the Obsolete attribute to tell other developers not to use the code, you can set the errors argument to true, and this will break the build anywhere that the code is being used.
I would start off by tagging the out-dated code elements with the Obsolete attribute. That way you will be able to locate any code that refers to the out-dated elements, giving you a way to update those parts. When you no longer get any compiler warnings that you use obsoleted code, go ahead and delete it.
Update: OK, now I was thinking .NET and C#, but I am sure many other languages have similar features...
I try to keep my application code as little as possible. Library code should be compatible for a number of release then remove it or just mark it as deprecated.
I totally agree with Neil. Use SVN or any other version control system to keep track of your code and delete anything that is redundant. Too much commented code only makes your code hard to read, and in some cases debugging impossible.
The best option is to remove the code so you have a cleaner repository. Most of the time it is just a short term fealing you delete somehting of potential enormous value.
Counting on svn if fellow programmer need it later won't really work. Because you have to know the code existed before and then some has to scan through the svn.
If I really think I want to keep that code than I usually make an archive out of the files and add them with a description into our wiki and then I delete the code. Over the search of the wiki someone can find the code. Scan it using the archive and as the decription contains repository and revision number they can even ressurect the parts they need easily.
If it's much, reusable and/or code difficult to reproduce, I usually put it into a file called <projectname>_rubbish.<ext>. Not very elegant but I can easily ignore it and also look for it seamlessly when I do need it again.
Install GIT then:
cd <code repo>
git init .
git add .
git commit -m 'inital import for my old code'
... Refactor the code ...
git add <path/to/file/with/changes/>
git commit -m 'that feels much better... :)'
... Create an account on GitHub or setup a GitServer
git remote add origin <remote git repo>
git push origin master
And you're done... :)
Simply delete it. If it is no longer required, there is no point in keeping it.

Resources