Chris Jean
Linux, WordPress, programming, anime, and other stuff
  • Home
  • Linux
  • Development
  • Random Ramblings

Archive for git

Great Tutorial on Merging with Git

by Chris Jean
November 12th, 2009

One of the functions of Git that I still struggle with is merging. Recently, I found a post that shows a number of very helpful merging examples. If you work with Git and don’t fully understand merging, I recommend that you check it out.

Git merging by example

My thanks to Jonathan Rockway on providing this great guide.

Originally, I wanted to duplicate the content on my site in case the content on the linked to site ceased to exist. Ironically, just days after publishing this, the site has crashed. So, I’ve recovered the content from the crash and have duplicated it here. The remaining content is from the site I linked to and not my own. If the content stays down for long, I’ll clean up my duplicate of it.

Read More→

Categories Tips 'n Tricks
Comments (0)

Recursively Updating Git Submodules

by Chris Jean
September 16th, 2009

I had fun writing about how I work with Git yesterday. I thought I’d continue on that thread.

I have a solid set of code libraries that I’ve written that latch into the WordPress themes we produce at iThemes. Each time code is duplicated across different repositories, I break that code out and make it into a separate repository. I then link it back into the project as a submodule. This makes it extremely-easy to keep duplicated code across numerous repositories updated with little or no fuss.

After cloning a repository, simply run git submodule init followed by git submodule update in order to initialize all the submodules and update their container folder with the content of the submodule’s repository. For a long time, this is exactly what I did when I would clone a theme repository to start working on it. However, this quickly wasn’t enough.

The problem happened as soon as I added a submodule to a repository that was also a submodule of other repositories. Doing the submodule init and update process wouldn’t do everything I needed in this case as there would be submodules in some subfolder that haven’t been set up.

I didn’t want to get into a habit of always switching to other directories and doing the submodule processes there as well since I 1) knew that I would forget all-too-often, thus wasting my time, and 2) knew that this would not be the last time that a submodule had submodules. Heck, there is even the possibility that I’ll have a submodule that has a submodule that has a submodule. It was immediately clear that I needed a script to do all this dirty work for me. The rest of this post will be about the script I created.

Read More→

Categories Development, Linux, Tips 'n Tricks
Comments (14)

Updating Multiple Git Repositories Easily Using Bash for Loop

by Chris Jean
September 15th, 2009

All of the WordPress themes that I work on for iThemes are managed as Git repositories. Recently, we moved past the 100 repositories mark. That’s a lot of repositories to manage, and unfortunately, too many of those repositories contain duplicated information.

Later on, I might delve into how we use Git to manage our theme repos. For today, however, I’d like to focus on how I quickly and easily pushed up changes to more than a dozen repos in a single, albeit long, Bash command.

I had finished making updates to 16 Flexx repos, and I needed to push all of those changes up. Since I had multiple working repos in that folder, I was lucky that each of these repos began with the text “Flexx”. Also, since they are all part of the same series and need to keep the same version number, that simplified the tagging as all could be tagged as 2.5.0.

Given this information, I simply ran the following command from the directory that contained all the repository directories:

for i in `ls|grep Flexx`; do echo “— Pushing $i”; cd $i; git commit -am ’2.5.0′ && git push && git tag 2.5.0 && git push –tags; cd ..; echo “— Finished $i”; done

There’s a lot going on here, so I’ll break it up and explain what I’m doing.

Read More→

Categories Development, Linux, Tips 'n Tricks
Comments (0)

Git Submodules: Adding, Using, Removing, Updating

by Chris Jean
April 20th, 2009

I’ve spent a little more than a month working with Git now. I can honestly say that while there are many things that I like about Git, there are just as many things that I personally find to be a pain in the butt.

Submodules specifically have managed to be a thorn in my side on many occasions. While the concept of submodules is simple, figuring out how to actually work with them can be a chore. I say “figuring out” because not everything about working with submodules is well documented. I’ll cover two of the more difficult things to figure out: removing and updating submodules from your repository.

Read More→

Categories Development, Tips 'n Tricks
Comments (45)

Goodbye Subversion, Hello Git

by Chris Jean
March 17th, 2009

As I mentioned before, I want to switch from using Subversion for project code collaboration and versioning to Git.

I’m switching not because I have some idealogical dread of Subversion or its methods. In fact, I quite like how much easier Subversion has made handling code collaboration. The problem I ran into is that Subversion has become doggedly slow and bloated.

For example, a simple project with a current working size of 2.9MB has a Subversion repository that is a massive 98MB in size. Furthermore, it takes a full four minutes to commit a change, even a simple one-line change to a text file. During this commit process, my server’s dual quad-core processors are essentially maxed. Why the repository has become so amazingly large and why the commits take so long, I’ll never know. The maxing out of my server for four minutes per commit is also unacceptable since there are times where minor changes will need to be made to more than a dozen repositories at a time. Multiply the number of commits by 4 minutes a piece, and not only is a terminal on my system tied up for more than an hour, but my server’s CPU is maxed for just as long.

Beginning last week, I dug into Git and learned what I needed to know. The initial impressions are great; however, Git is not without its problems either. The primary problem with Git is that its syntax is extremely-obscure, IMHO.

Read More→

Categories Development, Linux, Random Ramblings
Comments (0)

git: “Project description file hasn’t been set”

by Chris Jean
February 21st, 2009

I’m playing around with git as a possible replacement for Subversion (svn). I’ll probably blog about my reasons for wanting to switch and also have some tutorials. For now, I wanted to quickly share the fix for a problem I encountered that wasn’t really handled by the documentation.

I set up a bare remote repository to test git out. Everything looked good as I got this going, but then I hit a big snag.

When I tried to push the local repository back to the remote repository, I received the following error:

Read More→

Categories Development, Linux, Tips 'n Tricks
Comments (5)
Chris Jean
Copyright © 2012 All Rights Reserved
iThemes Builder by iThemes
Powered by WordPress