In working with apprentices new to Git and really new to source control in general, I have come across a couple cases where someone will have a repository defined within a repository. In these cases the parent repository is not tracking the files within the subdirectory and there appears to be nothing that can be done to resolve this. To paint a better picture let’s work with this example:
In this example there is a .git directory within both the project folder and the sub_project folder. Thus Git believes that these are separate repositories and in fact by design, although not correctly defined, believes that sub_project is a submodule of the project repository. I say not correctly defined since it cannot be found in a .gitmodules file. It only appears to be a submodule. We would have some work to do if we wanted it to be correctly defined. However, in the simple case we don’t want to do this and instead want to remove the repository from the subdirectory.
To fix the issue we need to delete the .git folder in the sub_project directory. We also need to remove the directory from the index of the project repository so that we may re-add the directory and be able to track the files within the sub_project directory in the project repository. To do this we can run the
git rm sub_project command. Thus to fix the issue:
1. delete the .git folder from the subdirectory
git rm sub_project
3. re-add the sub_project directory to the project repository
Now things should be ok and we should be able to continue using our project repository with no issues. We just need to be careful not to create repositories within the project directory unless we really want to have submodules.
In doing this again I did have to run
git rm with the
git rm --cached sub_project
In some cases you may run the
git commit --all command and think that it will stage and commit all the changes, deletions and new files that you have in your project. The truth is in the documentation of the
git commit, though…
git commit documentation
Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.
This means that in order to add new files to the repository you can’t just run
git commit. Instead you have to run
git add and then
Git is the source control management software of choice by many developers. It feels very light weight and yet is a fully functional and quite easy to use tool for most developers. For those that need extra help with Git there are a ton of resources out there for you, including this article.
So, to get started you should install Git. Go to the Git website (http://git-scm.com/downloads) and download the appropriate package based on your OS. This will install the tools necessary to use Git on your local system.
Steps for Starting a repository locally:
- Install Git
- Open the command promptterminal window
- Change the directory to where you would like to start a repository
you may use commands such as:
cd <<dir>> to change the current directory
mkdir <<dir>> to create a new directory or
md in windows
git init to create the repository in the current directory.
In a case where you have an existing repository that you want to have a copy of:
Follow Steps 1-3 as stated above. In step 3 you will go to the root directory of where you want the repository since getting a copy of the repository will create a directory for the repository.
git init, we will run
git clone to copy or clone the remote repository.
git clone <<url>> [directory]
<<url>> – could be a URL for GitHub or Bitbucket or just a remote network path
[directory] – is an optional parameter to provide the name of the directory you will create the clone in.
In either case you will result in a local Git repo that you can begin working in. You can create projects, store files and then use your git workflow to save your changes to a remote repo.
So, you create a new project in your favorite code editor. You only ever interact with the files in that code editor what more is there, right? Well, what about if your computer crashes, the hard drive wipes out or what about if you decide you need help on the project and you have to share the files with someone else. What would you do then…
This is where source control can be your friend. Source control allows us to store the code files in a central location (or rather just a remote one) and share these files with anyone we wish, or no one at all. Source control is that control we all need put on our code to make sure that we have history of the code, backups when necessary and the ability to very effectively collaborate with developers. It also encourages better coding practices as we can work on several different features at once isolating the code for each one. As we finish a specific feature we can merge it into the main product code and then work on another feature until that one is done.
In collaboration, source control allows for multiple developers to work on the same code base and check their code into a central or shared repository. This way the developers can work separately and code their given pieces in peace without stepping on each other. Once they are ready to share the code they can. The only time issues may arise is if they both work on the same file at the same time. In that case they may have a little extra effort to merge the work together. The reality of the situation is working together would be much more difficult if they didn’t use source control. Can you imagine trying to share code projects through zip files, or even drop box.
In short, be smart get on the source control go-kart! (after all go-karts are more fun than band wagons!)
iPhone5s 64GB has been the phone of choice for 2 years. The first note I will say is that this is the first phone in easily 5 years that I am not counting down the days to upgrade. I only have a month left and I am not sold on the iPhone6 but at the same time I am sold that I need to upgrade yet. I still really like the phone…
Battery: I get a day easy… light to moderate use one charge a day and I am good. Heavy use, a couple hours and I need an outlet. Now by light to moderate, I check emails, Facebook, twitter, linkedIn, play some words with friends and can surf the web a bit for a couple minutes here or there during the day and still have enough battery for a 30+ minute run with music going the whole time. I even turn the brightness way up when I am running. Otherwise the brightness is at maybe 25%. Increasing brightness for too long will drain it quick.
Apps: it’s apple… There’s a ton of apps and I haven’t found anything I wanted that Apple didn’t have an app for. I also have enjoyed iTunes cards as I can go buy these and use these instead of putting my credit card on the account.
Accessories: I am not a fan of thick, bulky cases. I started with an OtterBox and was ecstatic to have my wife’s break and thus I gave her mine and switched to a much smaller, thinner case. Now, of course, I know that I have to get use to a bigger phone in general and this is actually a reason I may hold off to upgrade. The only other accessory that I have is the ArmPocket arm band. It is awesome for running and no matter what phone I get I will be purchasing another one of these since they work with all phones.
Ecosystem: It’s Apple, as long as you are part of the ecosystem you are fine. I have as a result of this phone (had a 4s and didn’t go then) migrated to Apple for most things. I have a MacBook Pro, I still use my iPad way more than my Galaxy Tab and it doesn’t hurt to have the Apple TV around. However, If I go away from Apple and use, say, a Windows or Linux machine I better keep the mac close if I intend to do any IOS development. Otherwise as for transferring files it’s no problem with Drop Box, Google Drive and so many other options.
Would I get the phone again? absolutely… Not sure that there was any other phone out at the time that I would have been happier with.
Why would I move from an iPhone going forward? I am a tech guy. Curiosity over the latest stuff always gets the best of me. I also don’t see going to an Apple Watch as I am much more a Pebble Guy and get the feeling that Apple may stop playing so nice with them. I like when things play nice with multiple platforms. I don’t want to be tied down. Otherwise, I haven’t used Android in a while and my wife just got one and I am waiting to see what she thinks. Maybe a Turbo is in my future…