BowerStudios.com

  • My Lab
  • Family
  • Friends
  • Professional
  • About
Home » The Lab » Programming

Build Management and Source Control

Git - rollback last entry

daniel —Tue, 07/10/2012 - 10:42am

git reset --soft HEAD^

  • Build Management and Source Control
  • Read more about Git - rollback last entry
  • Log in to post comments

Git hooks

daniel —Thu, 05/10/2012 - 11:39am

Using git hooks to add processes when you commit locally or push to the server.

  • Build Management and Source Control
  • Read more about Git hooks
  • Log in to post comments

Move a project from one package structure to another in git

daniel —Tue, 04/10/2012 - 10:58am

I wanted to make doubly sure that git maintained the history past this change, so instead of using the ide to move a project from one project to another, I used a combination of mkdir, grep, git mv and rpl

First, move the actual files:
mkdir -p new/package; git mv old/package/app new/package/app; tree old

  • mkdir - create a directory and create parents/intermediates as necessary
  • git mv - move a file or directory in git
  • tree - display the contents of a directory recursively in a tree view - avail as a package in ubuntu

Find where old.package or old/package is used:
grep -ri "old\.package" . --exclude-dir=.git
grep -ri "old\/package" . --exclude-dir=.git

  • grep - find all instances of the given text in the current directory recursively

Replace old.package and old/package with new.package and new/package
rpl -aR 'old.package' 'new.package'
rpl -aR 'old/package' 'new/package'

  • rpl - replace all instance of the old text with the new text in the current directory recursively - avail as a package in ubuntu

Additional Tag: "Replace text in files from the Command Line"

  • Build Management and Source Control
  • Read more about Move a project from one package structure to another in git
  • Log in to post comments

Git - Merge in a Remote Branch

daniel —Tue, 02/22/2011 - 2:00pm

I forked a piece of code on github, and decided that I wanted to merge in someone else's changes. Below is how I did so:

First, clone my forked repo on github:
git clone git@github.com:danieldbower/Heard.git

Add the repo I'm interested in as a Remote
git remote add mattkatz https://github.com/mattkatz/Heard.git

Fetch that remote location to a local location
git fetch mattkatz

Pull the commit that I'm interested in
git merge bb78ad71e9a9107eae8d

Make sure everything is good
git status

Push back to my forked repo
git push

done

  • Build Management and Source Control
  • Read more about Git - Merge in a Remote Branch
  • Log in to post comments

Git Branching and Merging

daniel —Fri, 02/11/2011 - 4:02pm

I tend to work on very small teams (just me) so, I actually end up using the intermediate/advanced features of an scm fairly rarely. I pretty much just end up committing, and tagging. Today, though, I needed to do some branching and merging and I had a fairly decent experience doing so with git today.

Here is a basic rundown:

Was working in the master tree, and needed to make a branch for at an earlier commit.

What branch am I on now (should be on master in this case):
git branch

Branch the Code at the commit:
git branch 20110211-B4P 40da36be64709db8f7c0459a4de30e97d96cebd8
(git branch command)(name of the new branch)(Id of the earlier commit)

Switch to the branch:
git checkout 20110211-B4P

My temp files were not in version control, so I had to clear them out:
gradle clean

Make sure environment is sane before proceeding:
gradle test

Next, made all my changes and commit.

Now can push Branch to the origin if we want:
git push origin 20110211-B4P

Lets merge the changes we made to the branch into master.

First, switch to master branch:
git checkout master

Now merge:
git merge 20110211-B4P

Push that out too:
git push

Delete a local branch:
git branch -D 20110211-B4P

Delete a remote branch:
git push origin --delete 20110211-B4P

Reference:

  • Branch
  • Merge
  • Build Management and Source Control
  • Read more about Git Branching and Merging
  • Log in to post comments

Git - Add Remote Repository

daniel —Tue, 11/30/2010 - 11:42am

$ cd ~/Sites/myapp
$ git remote add origin ssh://myserver.com/var/git/myapp.git
$ git push -u origin master

Snippet from How to get a new remote repository going

The following may be needed if you leave out the -u in the git push argument, though I've not confirmed this.
Also needed to add the following config to the repo in .git/config
[branch "master"]
remote = origin
merge = refs/heads/master

This will allow you to simply do:
git push

instead of having to type this everytime (though you do need to do this on the very first push, but not afterwards):
git push origin master

  • Build Management and Source Control
  • Read more about Git - Add Remote Repository
  • 1 comment
  • Log in to post comments

Good article on sharing your git repo

daniel —Tue, 11/30/2010 - 11:41am

A good resource: 8 ways to share your git repository

  • Build Management and Source Control
  • Read more about Good article on sharing your git repo
  • Log in to post comments

Git stash is a quick alternative to branching

daniel —Tue, 11/30/2010 - 11:40am

Git stash documentation

Create a stash
git stash

Or create a stash and give it a name
git stash save "stash name"

View a list of stashes
git stash list

Apply the most recent stash to the repo
git stash pop

View contents of a stash
git stash show -p stash@{0}

Remove a stash without applying it:
git stash drop stash@{0}

  • Build Management and Source Control
  • Read more about Git stash is a quick alternative to branching
  • Log in to post comments

Git Merge Conflicts

daniel —Tue, 11/30/2010 - 11:37am

Sometimes git-pull results in merge conflicts.
What to do:
Just edit the file with the merge conflict - fixing it.
Commit that file, don't worry about any other files showing up via git-status.
Once you commit that file, you should be able to proceed with git pull and git push.

Git Resolving a merge documentation
Git Pull documentation
Git Reset documentation

  • Build Management and Source Control
  • Read more about Git Merge Conflicts
  • Log in to post comments

Starting with Git

daniel —Thu, 05/13/2010 - 11:25am

A list of handy links for getting up and running on Git quickly

  • Lazy Git
  • Cheat Sheet
  • Learn.GitHub compiles a lot of useful info about Git
  • How to get a new remote repository going
  • Can't forget the Pragmatic Programmers book on the subject
  • Undo

Suggestions for gitconfig
A gitconfig that I found interesting.

GitK - A TCL/TK gui for git

A nice explanation of what git really is by nfarina

Viewing your local repository as a web page

The Manual
The Community Manual

If you want to setup a remote repository on your Ubuntu machine.

  • Build Management and Source Control
  • Read more about Starting with Git
  • Log in to post comments

Pages

  • « first
  • ‹ previous
  • 1
  • 2
  • 3
  • 4
  • next ›
  • last »
Subscribe to RSS - Build Management and Source Control

Navigation

  • Search
  • Recent content
  • Contact Me
  • Mail
  • Pass Hasher
  • Bower Studios Admin

Quotes

daniel —Mon, 02/26/2007 - 12:29pm

Hell, there are no rules here - we're trying to accomplish something.

—

Thomas A. Edison

  • Log in to post comments
  • daniel's quotes

Popular content

Last viewed:

  • Monitoring Java/Groovy Apps
  • Debugging, view all Request, Session, and Cookie Information in a Java webapp
  • The Chunky Melting Pot
  • Thomas A. Edison
  • Professional

Copyright 2021 Daniel Bower
  • My Lab
  • Family
  • Friends
  • Professional
  • About