17
powered by The Basic Git Workflow … and what has been changed 01.2012

Checkitmobile Git Workshop

Embed Size (px)

Citation preview

Page 1: Checkitmobile Git Workshop

powered by

The Basic Git Workflow… and what has been changed

01.2012

Page 2: Checkitmobile Git Workshop

Moving from remote to local

The 1st and biggest change you should always remember:

You're now working with a local Repository.

Instead of commiting directly to remote, you'll commit from now on to your local Repository. Updating remote is done later.

Why is this useful?

Because it's not more centralized - we can now create commits even if we're offline or share branches with Team-Members directly.

Page 3: Checkitmobile Git Workshop

Moving from remote to local

Page 4: Checkitmobile Git Workshop

Moving from remote to local

create a first local commit

$ git commit -A -m „1st commit“

create a second local commit

$ git commit -A -m „2nd commit“

send both local commit's to remote

$ git push origin master

remote repository

origin/master

Page 5: Checkitmobile Git Workshop

Prepare commits with the Staging Area

The Staging Area is something like a loading ramp to prepare your next commit. So if you want to create a commit, you'll need to fill at first the Staging Area with a Set of files (which has been changed).

Why is this useful?

Instead of creating a commit in one big line, you can prepare commits and review it calmly. If you're sure everything is fine, you can easily commit the files from the Staging Area.

Page 6: Checkitmobile Git Workshop

$ git status

Changes not staged for commit:

… Gemfile

… app/controllers/application.rb

$ git add .

$ git status

Changes to be committed:

… Gemfile

… app/controllers/application.rb

$ git commit -m „remove comments“

[master] remove comments - 2 files changed, 2 deletions(-)

Page 7: Checkitmobile Git Workshop

Push changes to a remote Repository

After creating commits within our local repository. It's time to update the remote Repository and share our changes.

Our remote Repository is called „origin“ and it contains a „master“-Branch, which is basicly the trunk of our Git-Repository.

Later we can create additional sources like „birke“, to push changes from our local repository directly to a member.

$ git push origin master

Page 8: Checkitmobile Git Workshop

Pull changes from remote to local

The last step in the list of changes is to pull changes from remote to our local Repository.

Like mentioned before, we're possible to pull from different remote sources.

$ git pull origin master

Page 9: Checkitmobile Git Workshop

Using Git with Netbeans

Install Netbeans 7.01

with RubyOnRails

and Git-Plugin

Page 10: Checkitmobile Git Workshop

Using Git with Netbeans - Basics

Git → Show Changes: Display a window with all changed files

Git → Add: Add files to Staging Area

Git → Checkout files: Revert file to a given revision

Git → Revert modifications: Revert uncommited changes

Git → Show History: Revert uncommited changes

Page 11: Checkitmobile Git Workshop

Using Git with Netbeans - Committing

Select Git → Commit.

Enter your message

Commit the changes to your local Repository.

Page 12: Checkitmobile Git Workshop

Using Git with Netbeans – Pushing

To share commits with your Team, you'll need to push the local commit to the remote Repository.

1. Select Git→Push.

2. On the first step you'll see the Address of the remote Repository (keep it as it is) and click Next.

3. Select the Master-Branch and click once again on Next.

4. Keep the preselected Branch on remote and finally push your commits to remote.

Page 13: Checkitmobile Git Workshop

Using Git with Netbeans - Pushing

Page 14: Checkitmobile Git Workshop

Using Git with Netbeans – Pulling

To receive commits from your Team, you'll need to pull commits from the remote Repository.

1. Select Git→Pull.

2. On the first step you'll see the Address of the remote Repository (keep it as it is) and click Next.

3. Select the Master-Branch and click on Finish. You'll now receive the latest commits from remote.

Page 15: Checkitmobile Git Workshop

Updating Pandora

To keep Pandora up2date, use the pull-command to receive the latest commits from remote.

$ ssh deployer@pandora

$ cd CimRails/

$ git pull origin master

And reload Apache if necessary

Page 16: Checkitmobile Git Workshop

Resources

Install Git with Netbeans on Ubuntu/Mac

https://support.berlitec.de/projects/woabi/wiki/Setup_Netbeans_701_with_Git

Git CheatSheet

/cimdocs/ebooks/git/Git-Cheatsheet.pdf

Page 17: Checkitmobile Git Workshop

checkitmobile GmbH

Gerrit WandererRuby on Rails-Developer

Waldemarstr. 37a10999 Berlin

Tel: +49 30 921 228 61Mail: [email protected]

Contact