SlideShare ist ein Scribd-Unternehmen logo
1 von 57
Git for Force.com Developers
Managing code and Collaborating on projects
John Stevenson
Developer Evangelist
Salesforce.com
@jr0cket
Safe harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties
materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results
expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be
deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other
financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any
statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new
functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our
operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any
litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our
relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of
our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to
larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is
included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent
fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor
Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently
available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions
based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these
forward-looking statements.
What is this talk about
Understanding the value of Git
Taking your first steps Git
Using Git for Force.com projects
Collaborating with Git & Github
The value of Git
Understanding the value of Git
Manage your code changes over time
- understanding which version of your code is deployed
- rollback & compare to earlier versions
Experiment with code using branching
- branches are easily thrown away or merged if they are valuable
Collaborate easily
- share code commits using distributed nature of Git
Getting Started with Git
Taking your first steps Git
Install Git

http://git-scm.com/

Identify
yourself to git

git config --global user.name “”

Create your
first repository

git config --global user.email “”
git init
Salesforce Git Cheat Sheet available in the
Developer Library
The common Git commands
Creating a Git repository locally
Create a place to manage your changes
- stored in a folder called .git

git init
Removing the .git folder from your project removes any version
control and you will loose your change history
Adding files
You can tell git which file(s) you want to make
part of the next commit (version)
- either a specific file name or pattern, or using . every change
is added
git add filename
git add .
Understanding what has changed
Git Status gives an overview of local file changes
- you will use this command very often

git status
Git status helps you keep track of your changes and which ones
to make part of the next commit.
Creating a commit (version)
Create a commit with all the files in staging
- providing a message to describe this commit

git commit -m “useful commit message”
Commit messages help the team quickly review changes and
versions
Tracing your commits with Git log
Quickly review your change history
- this is where good commit messages speed things up

git log
git log --oneline --graph --decorate
The default output of Git Log is basic, if you use the command
line then create an alias with your preferred options
Create an alias for git log
Save yourself some typing by creating aliases
- these are saved in the file ~/.gitconfig

git config alias.lg
“log –oneline --graph –decorate”
You can also edit the ~/.gitconf file directly (if you are careful)
Seeing what code has changed
Compare your working files with existing commits
- helps you understand what changed, what should be committed next

git diff
git diff --cached
The --cached option compares the working directory with the
staged files rather than committed changes.
Staging and committing
Staging allows you to group changes across multiple files easily
- easier to un-stage files than remove from a commit
- gives another step to manage and compare changes
A Staged file is over-written when you “git add” the same file
- staging does not create a version
- commit when you have a meaningful (set of) change(s)
Share your changes with others
We work in teams, so we can share our commits
- via Github, an internal Git server or directly between developers

git push repository branch
git archive my-project.zip
An archive file (.tar or .zip) will contain the entire history of your
code by default
Using Git with Force.com IDE
Getting Force.com IDE
Download Eclipse version 4.2 or 4.3
- get the Java Developer edition

Add the Force.com IDE plugin
Eclipse uses a plugin called EGit to work with local and remote
repositories, this is part of the Java Developer version
Identifying yourself to Git with Force.com IDE
You will be prompted for your user information when you create
your first commit
Identifying yourself to Git with Force.com IDE
Force.com IDE will use ~/.gitconfig if it already exists
Using Git for Force.com projects
Window > Open Perspective > Git repository exploring
Creating a repository with Force.com IDE
Creating a repository with Force.com IDE
Provide the location and name for your local repository

Don’t select a bare repository as you will not be able to use a working directory
Creating a repository with Force.com IDE
Using Git & Force.com IDE
with an Apex project
Using the Apex Workbook as the example project
Creating a Developer Org
Create a new developer Org
- via developer.force.com
Install a package to create the custom objects our Apex code is
going to work with
- http://bit.ly/ApexWorkbookPackage1_4
Load data into your Developer Org
Open the Developer Console
1) click Debug > Open Execute Anonymous Window
2) the Enter Apex Code window is displayed
3) Enter the following apex code and execute
ApexWorkbook.loadData();
Creating a new project in Force.com IDE
Change to the Force.com Perspective
See the newly created project
Create your first Apex class
Code your Apex class
New Class files marked as untracked
New files and their parent folders are marked with ?
Adding the HelloWorld class to Git
Switch to Git Repository Exploring perspective
Right-click the file name and select Add to Git index
Comparing additional changes with staging
Committing your new code locally
Enter a useful commit message and press commit
Syncronize your changes with your Org
View the local commit history
View details of a commit
Github
Social Coding
Collaborating with Github
Collaborate as a team
Work on Open Source projects
Get contributions from anyone in the world
Include code review into your change management
Creating, Forking & Cloning
Creating a repository & Forking a repository
- via the Github website
Cloning a repository (get a local copy)
git clone alias repository-address
Sharing changes back to Github
Git Push sends all commits that are only in your local
repository to Github
Specify with repository (alias name) and branch you want to share
git push alias branch
Cloning a repository in Force.com IDE
Tips when using
Github & Force.com IDE
Be wary of what you name your project
Project & Git repository names should match
A repository on Github has a web address (URL)
- avoid using spaces and special characters
Suggested approach
- create your repository on Github first
- clone your github repository to your laptop
- create a project in Force.com
Commit changes before sync’ing
Commit changes before syncing or merging with your org
- ensure you don’t loose local changes
- commit before using “Save to Server” or “Synchronize with
Server”
Create a branch if you are not sure you want to keep your code
changes
- or use “git stash” if you have many unrelated changes
Drive all changes locally
Avoid making changes directly on the Org
- or sync changes to locally as soon as you make them
Changes on the server are too easy to forget
- can make merging changes more complicated
- more likelihood of merge conflicts, meaning more work for the
team
Where to go next
try.git.com – free online interactive training
Git Visual Cheetsheet – interactive command reference
Salesforce Git Cheatsheet - available at Dreamforce in the
Developer Library
Practice !
Thank you
John Stevenson
Developer Evangelist
@jr0cket

git-scm.com
try.github.com
developer.force.com
blog.jr0cket.co.uk
Dreamforce 13 developer session: Git for Force.com developers

Weitere ähnliche Inhalte

Was ist angesagt?

TDX19 - Accelerate DevOps with GitLab and Salesforce
TDX19 - Accelerate DevOps with GitLab and SalesforceTDX19 - Accelerate DevOps with GitLab and Salesforce
TDX19 - Accelerate DevOps with GitLab and SalesforceDoug Ayers
 
Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)Alexis Williams
 
Best Practices for Successful Deployment
Best Practices for Successful DeploymentBest Practices for Successful Deployment
Best Practices for Successful DeploymentSalesforce Developers
 
Managing Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox ArchitectureManaging Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox ArchitectureAlexander Sutherland
 
Scaling Continuous Integration for Puppet
Scaling Continuous Integration for PuppetScaling Continuous Integration for Puppet
Scaling Continuous Integration for PuppetSalesforce Engineering
 
Dependency Injection with the Force DI Framework
Dependency Injection with the Force DI FrameworkDependency Injection with the Force DI Framework
Dependency Injection with the Force DI FrameworkDoug Ayers
 
Continuous Integration and Testing with Branch Orgs
Continuous Integration and Testing with Branch OrgsContinuous Integration and Testing with Branch Orgs
Continuous Integration and Testing with Branch OrgsSalesforce Developers
 
Salesforce API Series: Release Management with the Metadata API webinar
Salesforce API Series: Release Management with the Metadata API webinarSalesforce API Series: Release Management with the Metadata API webinar
Salesforce API Series: Release Management with the Metadata API webinarSalesforce Developers
 
Design patterns for salesforce app decomposition
Design patterns for salesforce app decompositionDesign patterns for salesforce app decomposition
Design patterns for salesforce app decompositionSai Jithesh ☁️
 
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Salesforce Developers
 
5 Essentials for Simplifiied Release Management and Continuous Delivery
5 Essentials for Simplifiied Release Management and Continuous Delivery5 Essentials for Simplifiied Release Management and Continuous Delivery
5 Essentials for Simplifiied Release Management and Continuous DeliverySalesforce Developers
 
Salesforce Release Management - Best Practices and Tools for Deployment
Salesforce Release Management - Best Practices and Tools for DeploymentSalesforce Release Management - Best Practices and Tools for Deployment
Salesforce Release Management - Best Practices and Tools for DeploymentSalesforce Developers
 
How Open Source Embiggens Salesforce.com
How Open Source Embiggens Salesforce.comHow Open Source Embiggens Salesforce.com
How Open Source Embiggens Salesforce.comSalesforce Engineering
 
The definitive guide to salesforce sandbox flosum
The definitive guide to salesforce sandbox flosumThe definitive guide to salesforce sandbox flosum
The definitive guide to salesforce sandbox flosumFlosum
 
DevOps in Salesforce AppCloud
DevOps in Salesforce AppCloudDevOps in Salesforce AppCloud
DevOps in Salesforce AppCloudrsg00usa
 
Salesforce Continuous Integration with AutoRABIT
Salesforce Continuous Integration with AutoRABITSalesforce Continuous Integration with AutoRABIT
Salesforce Continuous Integration with AutoRABITVishnu Raju Datla
 
Introduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce PlatformIntroduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce PlatformSalesforce Developers
 
CodeLive with Adam Daw - Building a mobile friendly geolocation aware candy t...
CodeLive with Adam Daw - Building a mobile friendly geolocation aware candy t...CodeLive with Adam Daw - Building a mobile friendly geolocation aware candy t...
CodeLive with Adam Daw - Building a mobile friendly geolocation aware candy t...JackGuo20
 
Continuous Delivery (Internet-Briefing 2012-04-03)
Continuous Delivery (Internet-Briefing 2012-04-03)Continuous Delivery (Internet-Briefing 2012-04-03)
Continuous Delivery (Internet-Briefing 2012-04-03)Netcetera
 

Was ist angesagt? (20)

TDX19 - Accelerate DevOps with GitLab and Salesforce
TDX19 - Accelerate DevOps with GitLab and SalesforceTDX19 - Accelerate DevOps with GitLab and Salesforce
TDX19 - Accelerate DevOps with GitLab and Salesforce
 
Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)
 
Best Practices for Successful Deployment
Best Practices for Successful DeploymentBest Practices for Successful Deployment
Best Practices for Successful Deployment
 
Managing Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox ArchitectureManaging Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox Architecture
 
Scaling Continuous Integration for Puppet
Scaling Continuous Integration for PuppetScaling Continuous Integration for Puppet
Scaling Continuous Integration for Puppet
 
Dependency Injection with the Force DI Framework
Dependency Injection with the Force DI FrameworkDependency Injection with the Force DI Framework
Dependency Injection with the Force DI Framework
 
Continuous Integration and Testing with Branch Orgs
Continuous Integration and Testing with Branch OrgsContinuous Integration and Testing with Branch Orgs
Continuous Integration and Testing with Branch Orgs
 
Salesforce API Series: Release Management with the Metadata API webinar
Salesforce API Series: Release Management with the Metadata API webinarSalesforce API Series: Release Management with the Metadata API webinar
Salesforce API Series: Release Management with the Metadata API webinar
 
Design patterns for salesforce app decomposition
Design patterns for salesforce app decompositionDesign patterns for salesforce app decomposition
Design patterns for salesforce app decomposition
 
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
 
5 Essentials for Simplifiied Release Management and Continuous Delivery
5 Essentials for Simplifiied Release Management and Continuous Delivery5 Essentials for Simplifiied Release Management and Continuous Delivery
5 Essentials for Simplifiied Release Management and Continuous Delivery
 
Salesforce Release Management - Best Practices and Tools for Deployment
Salesforce Release Management - Best Practices and Tools for DeploymentSalesforce Release Management - Best Practices and Tools for Deployment
Salesforce Release Management - Best Practices and Tools for Deployment
 
How Open Source Embiggens Salesforce.com
How Open Source Embiggens Salesforce.comHow Open Source Embiggens Salesforce.com
How Open Source Embiggens Salesforce.com
 
The definitive guide to salesforce sandbox flosum
The definitive guide to salesforce sandbox flosumThe definitive guide to salesforce sandbox flosum
The definitive guide to salesforce sandbox flosum
 
DevOps in Salesforce AppCloud
DevOps in Salesforce AppCloudDevOps in Salesforce AppCloud
DevOps in Salesforce AppCloud
 
Salesforce Continuous Integration with AutoRABIT
Salesforce Continuous Integration with AutoRABITSalesforce Continuous Integration with AutoRABIT
Salesforce Continuous Integration with AutoRABIT
 
Introduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce PlatformIntroduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce Platform
 
CodeLive with Adam Daw - Building a mobile friendly geolocation aware candy t...
CodeLive with Adam Daw - Building a mobile friendly geolocation aware candy t...CodeLive with Adam Daw - Building a mobile friendly geolocation aware candy t...
CodeLive with Adam Daw - Building a mobile friendly geolocation aware candy t...
 
Continuous Delivery (Internet-Briefing 2012-04-03)
Continuous Delivery (Internet-Briefing 2012-04-03)Continuous Delivery (Internet-Briefing 2012-04-03)
Continuous Delivery (Internet-Briefing 2012-04-03)
 
Under the Hood of Sandbox Templates
Under the Hood of Sandbox TemplatesUnder the Hood of Sandbox Templates
Under the Hood of Sandbox Templates
 

Ähnlich wie Dreamforce 13 developer session: Git for Force.com developers

Ähnlich wie Dreamforce 13 developer session: Git for Force.com developers (20)

2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Git
GitGit
Git
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
Git workshop
Git workshopGit workshop
Git workshop
 
Dreamforce14 Metadata Management with Git Version Control
Dreamforce14 Metadata Management with Git Version ControlDreamforce14 Metadata Management with Git Version Control
Dreamforce14 Metadata Management with Git Version Control
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01
 
Version control with git
Version control with gitVersion control with git
Version control with git
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucket
 
Git 101
Git 101Git 101
Git 101
 
Webinar : SVN to GIT Migration
Webinar : SVN to GIT Migration Webinar : SVN to GIT Migration
Webinar : SVN to GIT Migration
 
Git session 1
Git session 1Git session 1
Git session 1
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Git cheat sheet__grey
Git cheat sheet__greyGit cheat sheet__grey
Git cheat sheet__grey
 
Git cheat sheet__white
Git cheat sheet__whiteGit cheat sheet__white
Git cheat sheet__white
 
Git cheat sheet_dark
Git cheat sheet_darkGit cheat sheet_dark
Git cheat sheet_dark
 
Introduction to git & github
Introduction to git & githubIntroduction to git & github
Introduction to git & github
 
Git and Github
Git and GithubGit and Github
Git and Github
 

Mehr von John Stevenson

ClojureX Conference 2017 - 10 amazing years of Clojure
ClojureX Conference 2017 - 10 amazing years of ClojureClojureX Conference 2017 - 10 amazing years of Clojure
ClojureX Conference 2017 - 10 amazing years of ClojureJohn Stevenson
 
Confessions of a developer community builder
Confessions of a developer community builderConfessions of a developer community builder
Confessions of a developer community builderJohn Stevenson
 
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptJohn Stevenson
 
Introduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptIntroduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptJohn Stevenson
 
Thinking Functionally with Clojure
Thinking Functionally with ClojureThinking Functionally with Clojure
Thinking Functionally with ClojureJohn Stevenson
 
Communication improbable
Communication improbableCommunication improbable
Communication improbableJohn Stevenson
 
Getting into public speaking at conferences
Getting into public speaking at conferencesGetting into public speaking at conferences
Getting into public speaking at conferencesJohn Stevenson
 
Functional web with clojure
Functional web with clojureFunctional web with clojure
Functional web with clojureJohn Stevenson
 
Get into Functional Programming with Clojure
Get into Functional Programming with ClojureGet into Functional Programming with Clojure
Get into Functional Programming with ClojureJohn Stevenson
 
Guiding people into Clojure
Guiding people into ClojureGuiding people into Clojure
Guiding people into ClojureJohn Stevenson
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperJohn Stevenson
 
Get Functional Programming with Clojure
Get Functional Programming with ClojureGet Functional Programming with Clojure
Get Functional Programming with ClojureJohn Stevenson
 
So you want to run a developer event, are you crazy?
So you want to run a developer event, are you crazy?So you want to run a developer event, are you crazy?
So you want to run a developer event, are you crazy?John Stevenson
 
Trailhead live - Overview of Salesforce App Cloud
Trailhead live - Overview of Salesforce App CloudTrailhead live - Overview of Salesforce App Cloud
Trailhead live - Overview of Salesforce App CloudJohn Stevenson
 
Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developersJohn Stevenson
 
Introducing the Salesforce platform
Introducing the Salesforce platformIntroducing the Salesforce platform
Introducing the Salesforce platformJohn Stevenson
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with ClojureJohn Stevenson
 
Salesforce Summer of Hacks London - Introduction
Salesforce Summer of Hacks London - IntroductionSalesforce Summer of Hacks London - Introduction
Salesforce Summer of Hacks London - IntroductionJohn Stevenson
 
Heroku Introduction: Scaling customer facing apps & services
Heroku Introduction: Scaling customer facing apps & servicesHeroku Introduction: Scaling customer facing apps & services
Heroku Introduction: Scaling customer facing apps & servicesJohn Stevenson
 
Developers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 PlatformDevelopers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 PlatformJohn Stevenson
 

Mehr von John Stevenson (20)

ClojureX Conference 2017 - 10 amazing years of Clojure
ClojureX Conference 2017 - 10 amazing years of ClojureClojureX Conference 2017 - 10 amazing years of Clojure
ClojureX Conference 2017 - 10 amazing years of Clojure
 
Confessions of a developer community builder
Confessions of a developer community builderConfessions of a developer community builder
Confessions of a developer community builder
 
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
 
Introduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptIntroduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with Clojurescript
 
Thinking Functionally with Clojure
Thinking Functionally with ClojureThinking Functionally with Clojure
Thinking Functionally with Clojure
 
Communication improbable
Communication improbableCommunication improbable
Communication improbable
 
Getting into public speaking at conferences
Getting into public speaking at conferencesGetting into public speaking at conferences
Getting into public speaking at conferences
 
Functional web with clojure
Functional web with clojureFunctional web with clojure
Functional web with clojure
 
Get into Functional Programming with Clojure
Get into Functional Programming with ClojureGet into Functional Programming with Clojure
Get into Functional Programming with Clojure
 
Guiding people into Clojure
Guiding people into ClojureGuiding people into Clojure
Guiding people into Clojure
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
Get Functional Programming with Clojure
Get Functional Programming with ClojureGet Functional Programming with Clojure
Get Functional Programming with Clojure
 
So you want to run a developer event, are you crazy?
So you want to run a developer event, are you crazy?So you want to run a developer event, are you crazy?
So you want to run a developer event, are you crazy?
 
Trailhead live - Overview of Salesforce App Cloud
Trailhead live - Overview of Salesforce App CloudTrailhead live - Overview of Salesforce App Cloud
Trailhead live - Overview of Salesforce App Cloud
 
Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developers
 
Introducing the Salesforce platform
Introducing the Salesforce platformIntroducing the Salesforce platform
Introducing the Salesforce platform
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with Clojure
 
Salesforce Summer of Hacks London - Introduction
Salesforce Summer of Hacks London - IntroductionSalesforce Summer of Hacks London - Introduction
Salesforce Summer of Hacks London - Introduction
 
Heroku Introduction: Scaling customer facing apps & services
Heroku Introduction: Scaling customer facing apps & servicesHeroku Introduction: Scaling customer facing apps & services
Heroku Introduction: Scaling customer facing apps & services
 
Developers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 PlatformDevelopers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 Platform
 

Kürzlich hochgeladen

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Kürzlich hochgeladen (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

Dreamforce 13 developer session: Git for Force.com developers

  • 1. Git for Force.com Developers Managing code and Collaborating on projects John Stevenson Developer Evangelist Salesforce.com @jr0cket
  • 2. Safe harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  • 3. What is this talk about Understanding the value of Git Taking your first steps Git Using Git for Force.com projects Collaborating with Git & Github
  • 5. Understanding the value of Git Manage your code changes over time - understanding which version of your code is deployed - rollback & compare to earlier versions Experiment with code using branching - branches are easily thrown away or merged if they are valuable Collaborate easily - share code commits using distributed nature of Git
  • 7. Taking your first steps Git Install Git http://git-scm.com/ Identify yourself to git git config --global user.name “” Create your first repository git config --global user.email “” git init
  • 8.
  • 9. Salesforce Git Cheat Sheet available in the Developer Library
  • 10.
  • 11. The common Git commands
  • 12. Creating a Git repository locally Create a place to manage your changes - stored in a folder called .git git init Removing the .git folder from your project removes any version control and you will loose your change history
  • 13. Adding files You can tell git which file(s) you want to make part of the next commit (version) - either a specific file name or pattern, or using . every change is added git add filename git add .
  • 14. Understanding what has changed Git Status gives an overview of local file changes - you will use this command very often git status Git status helps you keep track of your changes and which ones to make part of the next commit.
  • 15. Creating a commit (version) Create a commit with all the files in staging - providing a message to describe this commit git commit -m “useful commit message” Commit messages help the team quickly review changes and versions
  • 16. Tracing your commits with Git log Quickly review your change history - this is where good commit messages speed things up git log git log --oneline --graph --decorate The default output of Git Log is basic, if you use the command line then create an alias with your preferred options
  • 17. Create an alias for git log Save yourself some typing by creating aliases - these are saved in the file ~/.gitconfig git config alias.lg “log –oneline --graph –decorate” You can also edit the ~/.gitconf file directly (if you are careful)
  • 18. Seeing what code has changed Compare your working files with existing commits - helps you understand what changed, what should be committed next git diff git diff --cached The --cached option compares the working directory with the staged files rather than committed changes.
  • 19.
  • 20. Staging and committing Staging allows you to group changes across multiple files easily - easier to un-stage files than remove from a commit - gives another step to manage and compare changes A Staged file is over-written when you “git add” the same file - staging does not create a version - commit when you have a meaningful (set of) change(s)
  • 21. Share your changes with others We work in teams, so we can share our commits - via Github, an internal Git server or directly between developers git push repository branch git archive my-project.zip An archive file (.tar or .zip) will contain the entire history of your code by default
  • 22. Using Git with Force.com IDE
  • 23. Getting Force.com IDE Download Eclipse version 4.2 or 4.3 - get the Java Developer edition Add the Force.com IDE plugin Eclipse uses a plugin called EGit to work with local and remote repositories, this is part of the Java Developer version
  • 24. Identifying yourself to Git with Force.com IDE You will be prompted for your user information when you create your first commit
  • 25. Identifying yourself to Git with Force.com IDE Force.com IDE will use ~/.gitconfig if it already exists
  • 26. Using Git for Force.com projects Window > Open Perspective > Git repository exploring
  • 27. Creating a repository with Force.com IDE
  • 28. Creating a repository with Force.com IDE Provide the location and name for your local repository Don’t select a bare repository as you will not be able to use a working directory
  • 29. Creating a repository with Force.com IDE
  • 30. Using Git & Force.com IDE with an Apex project Using the Apex Workbook as the example project
  • 31. Creating a Developer Org Create a new developer Org - via developer.force.com Install a package to create the custom objects our Apex code is going to work with - http://bit.ly/ApexWorkbookPackage1_4
  • 32. Load data into your Developer Org Open the Developer Console 1) click Debug > Open Execute Anonymous Window 2) the Enter Apex Code window is displayed 3) Enter the following apex code and execute ApexWorkbook.loadData();
  • 33. Creating a new project in Force.com IDE
  • 34. Change to the Force.com Perspective See the newly created project
  • 35. Create your first Apex class
  • 36. Code your Apex class
  • 37. New Class files marked as untracked New files and their parent folders are marked with ?
  • 38. Adding the HelloWorld class to Git Switch to Git Repository Exploring perspective Right-click the file name and select Add to Git index
  • 40. Committing your new code locally Enter a useful commit message and press commit
  • 41. Syncronize your changes with your Org
  • 42. View the local commit history
  • 43. View details of a commit
  • 45. Collaborating with Github Collaborate as a team Work on Open Source projects Get contributions from anyone in the world Include code review into your change management
  • 46.
  • 47. Creating, Forking & Cloning Creating a repository & Forking a repository - via the Github website Cloning a repository (get a local copy) git clone alias repository-address
  • 48. Sharing changes back to Github Git Push sends all commits that are only in your local repository to Github Specify with repository (alias name) and branch you want to share git push alias branch
  • 49. Cloning a repository in Force.com IDE
  • 50. Tips when using Github & Force.com IDE
  • 51. Be wary of what you name your project Project & Git repository names should match A repository on Github has a web address (URL) - avoid using spaces and special characters Suggested approach - create your repository on Github first - clone your github repository to your laptop - create a project in Force.com
  • 52. Commit changes before sync’ing Commit changes before syncing or merging with your org - ensure you don’t loose local changes - commit before using “Save to Server” or “Synchronize with Server” Create a branch if you are not sure you want to keep your code changes - or use “git stash” if you have many unrelated changes
  • 53. Drive all changes locally Avoid making changes directly on the Org - or sync changes to locally as soon as you make them Changes on the server are too easy to forget - can make merging changes more complicated - more likelihood of merge conflicts, meaning more work for the team
  • 54. Where to go next try.git.com – free online interactive training Git Visual Cheetsheet – interactive command reference Salesforce Git Cheatsheet - available at Dreamforce in the Developer Library Practice !
  • 55.
  • 56. Thank you John Stevenson Developer Evangelist @jr0cket git-scm.com try.github.com developer.force.com blog.jr0cket.co.uk

Hinweis der Redaktion

  1. You don’t need to remember all the commands I show you, there is a quickstart guide to give you a reference to all the common commands you will use first. There is a more detailed “Cheat sheet” available at Dreamforce
  2. Insert diagram
  3. To keep this nice and simple I am going to create some text files and capture different versions of those files in Git. This shows what each of these commands does, so even if only use Git via Force.com IDE you know what those commands are doing. This helps you make use of Force.com IDE more efficiently.
  4. Diff’ing
  5. Diff’ing
  6. Diff’ing
  7. Diff’ing
  8. Diff’ing
  9. Diff’ing
  10. Diff’ing
  11. TODO – fix diagram – git diff next to local repo shold not have the –cached option, it should be on the git diff against staging
  12. Diff’ing
  13. Diff’ing
  14. Add screenshots of using Eclipse and …
  15. Add screenshots of using Eclipse and …
  16. Add screenshots of using Eclipse and …
  17. Add screenshots of using Eclipse and …
  18. Add screenshots of using Eclipse and …
  19. A bare repository is one without a working directory. Files cannot be added, as the repository can only receive changes via a push to it.
  20. Add screenshots of using Eclipse and …
  21. Add screenshots of using Eclipse and …
  22. Add screenshots of using Eclipse and …
  23. Taking tips from the Blog Sandeep wrote on using Git.
  24. Taking tips from the Blog Sandeep wrote on using Git.
  25. Add screenshots of using Eclipse and …
  26. Add screenshots of using Eclipse and …
  27. Add screenshots of using Eclipse and …
  28. Add screenshots of using Eclipse and …
  29. Add screenshots of using Eclipse and …
  30. Add screenshots of using Eclipse and …
  31. Add screenshots of using Eclipse and …