SlideShare una empresa de Scribd logo
1 de 57
Descargar para leer sin conexión
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/
git config --global user.name “”

Identify yourself
git config --global user.email “”
to git
Create your
first repository

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
Git for Force.com Developers: Managing Code and Collaborating on Projects

Más contenido relacionado

La actualidad más candente

A Brief Introduction to Software Configuration Management
A Brief Introduction to Software Configuration ManagementA Brief Introduction to Software Configuration Management
A Brief Introduction to Software Configuration ManagementMd Mamunur Rashid
 
Salesforce.com Sandbox management
Salesforce.com Sandbox management Salesforce.com Sandbox management
Salesforce.com Sandbox management Ali Akbar
 
Git flow
Git flowGit flow
Git flowshaokun
 
Introduction To Software Configuration Management
Introduction To Software Configuration ManagementIntroduction To Software Configuration Management
Introduction To Software Configuration ManagementRajesh Kumar
 
Validation testing
Validation testingValidation testing
Validation testingSlideshare
 
Software Inspection And Defect Management
Software Inspection And Defect ManagementSoftware Inspection And Defect Management
Software Inspection And Defect ManagementAjay K
 
Software Reuse: Challenges and Business Success
Software Reuse: Challenges and Business SuccessSoftware Reuse: Challenges and Business Success
Software Reuse: Challenges and Business SuccessUniversity of Zurich
 
Best Practices for RESTful Web Services
Best Practices for RESTful Web ServicesBest Practices for RESTful Web Services
Best Practices for RESTful Web ServicesSalesforce Developers
 
How to Setup Continuous Integration With Git, Jenkins, and Force.com
How to Setup Continuous Integration With Git, Jenkins, and Force.comHow to Setup Continuous Integration With Git, Jenkins, and Force.com
How to Setup Continuous Integration With Git, Jenkins, and Force.comSalesforce Developers
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
Taking your version control to a next level with TFS and Git
Taking your version control to a next level with TFS and GitTaking your version control to a next level with TFS and Git
Taking your version control to a next level with TFS and GitAlexander Vanwynsberghe
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabShinu Suresh
 
Software life cycle comparison
Software life cycle comparisonSoftware life cycle comparison
Software life cycle comparisonSuvek Shakya
 
Configuration Management
Configuration ManagementConfiguration Management
Configuration Managementahmad bassiouny
 

La actualidad más candente (20)

A Brief Introduction to Software Configuration Management
A Brief Introduction to Software Configuration ManagementA Brief Introduction to Software Configuration Management
A Brief Introduction to Software Configuration Management
 
Subversion
SubversionSubversion
Subversion
 
Salesforce.com Sandbox management
Salesforce.com Sandbox management Salesforce.com Sandbox management
Salesforce.com Sandbox management
 
Git flow
Git flowGit flow
Git flow
 
Introduction To Software Configuration Management
Introduction To Software Configuration ManagementIntroduction To Software Configuration Management
Introduction To Software Configuration Management
 
Git-Dasar
Git-DasarGit-Dasar
Git-Dasar
 
Validation testing
Validation testingValidation testing
Validation testing
 
Software Inspection And Defect Management
Software Inspection And Defect ManagementSoftware Inspection And Defect Management
Software Inspection And Defect Management
 
Software Reuse: Challenges and Business Success
Software Reuse: Challenges and Business SuccessSoftware Reuse: Challenges and Business Success
Software Reuse: Challenges and Business Success
 
Best Practices for RESTful Web Services
Best Practices for RESTful Web ServicesBest Practices for RESTful Web Services
Best Practices for RESTful Web Services
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Svn Basic Tutorial
Svn Basic TutorialSvn Basic Tutorial
Svn Basic Tutorial
 
How to Setup Continuous Integration With Git, Jenkins, and Force.com
How to Setup Continuous Integration With Git, Jenkins, and Force.comHow to Setup Continuous Integration With Git, Jenkins, and Force.com
How to Setup Continuous Integration With Git, Jenkins, and Force.com
 
Git advanced
Git advancedGit advanced
Git advanced
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Taking your version control to a next level with TFS and Git
Taking your version control to a next level with TFS and GitTaking your version control to a next level with TFS and Git
Taking your version control to a next level with TFS and Git
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLab
 
Software life cycle comparison
Software life cycle comparisonSoftware life cycle comparison
Software life cycle comparison
 
Configuration Management
Configuration ManagementConfiguration Management
Configuration Management
 

Destacado

Team Development on Force.com with Github and Ant
Team Development on Force.com with Github and AntTeam Development on Force.com with Github and Ant
Team Development on Force.com with Github and AntSalesforce Developers
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheetAkash Amar
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheetAkash Amar
 
Intro to Version Control with Git and Github
Intro to Version Control with Git and GithubIntro to Version Control with Git and Github
Intro to Version Control with Git and GithubJoe Fleming
 
Automating Deployment Between Orgs Using Git & Continuous Integration
Automating Deployment Between Orgs Using Git & Continuous IntegrationAutomating Deployment Between Orgs Using Git & Continuous Integration
Automating Deployment Between Orgs Using Git & Continuous IntegrationSebastian Wagner
 
Apex code-fundamentals
Apex code-fundamentalsApex code-fundamentals
Apex code-fundamentalsAmit Sharma
 
Apex basics-for Beginners
Apex basics-for BeginnersApex basics-for Beginners
Apex basics-for Beginnershrakhra
 
Salesforce開発プロジェクトの進め方とアプリケーションライフサイクルマネジメント
Salesforce開発プロジェクトの進め方とアプリケーションライフサイクルマネジメントSalesforce開発プロジェクトの進め方とアプリケーションライフサイクルマネジメント
Salesforce開発プロジェクトの進め方とアプリケーションライフサイクルマネジメントSalesforce Developers Japan
 
Salesforce Presentation
Salesforce PresentationSalesforce Presentation
Salesforce PresentationChetna Purohit
 
Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex codeEdwinOstos
 

Destacado (17)

Git in Eclipse
Git in EclipseGit in Eclipse
Git in Eclipse
 
Team Development on Force.com with Github and Ant
Team Development on Force.com with Github and AntTeam Development on Force.com with Github and Ant
Team Development on Force.com with Github and Ant
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
 
Intro to Version Control with Git and Github
Intro to Version Control with Git and GithubIntro to Version Control with Git and Github
Intro to Version Control with Git and Github
 
Hybrid Clouds: EC2/Heroku Calculator
Hybrid Clouds: EC2/Heroku CalculatorHybrid Clouds: EC2/Heroku Calculator
Hybrid Clouds: EC2/Heroku Calculator
 
Automating Deployment Between Orgs Using Git & Continuous Integration
Automating Deployment Between Orgs Using Git & Continuous IntegrationAutomating Deployment Between Orgs Using Git & Continuous Integration
Automating Deployment Between Orgs Using Git & Continuous Integration
 
3 Git
3 Git3 Git
3 Git
 
Apex code-fundamentals
Apex code-fundamentalsApex code-fundamentals
Apex code-fundamentals
 
Apex basics-for Beginners
Apex basics-for BeginnersApex basics-for Beginners
Apex basics-for Beginners
 
Salesforce
Salesforce Salesforce
Salesforce
 
Salesforce開発プロジェクトの進め方とアプリケーションライフサイクルマネジメント
Salesforce開発プロジェクトの進め方とアプリケーションライフサイクルマネジメントSalesforce開発プロジェクトの進め方とアプリケーションライフサイクルマネジメント
Salesforce開発プロジェクトの進め方とアプリケーションライフサイクルマネジメント
 
Git Presentation
Git PresentationGit Presentation
Git Presentation
 
Salesforce Presentation
Salesforce PresentationSalesforce Presentation
Salesforce Presentation
 
Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex code
 
Lightning Experience 時代のフロー開発
Lightning Experience 時代のフロー開発Lightning Experience 時代のフロー開発
Lightning Experience 時代のフロー開発
 

Similar a Git for Force.com Developers: Managing Code and Collaborating on Projects

Similar a Git for Force.com Developers: Managing Code and Collaborating on Projects (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
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucket
 
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
 
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
 

Más de Salesforce Developers

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSalesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceSalesforce Developers
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base ComponentsSalesforce Developers
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsSalesforce Developers
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaSalesforce Developers
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentSalesforce Developers
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsSalesforce Developers
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsSalesforce Developers
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsSalesforce Developers
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and TestingSalesforce Developers
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilitySalesforce Developers
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce dataSalesforce Developers
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionSalesforce Developers
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPSalesforce Developers
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceSalesforce Developers
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureSalesforce Developers
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DXSalesforce Developers
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectSalesforce Developers
 

Más de Salesforce Developers (20)

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base Components
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer Highlights
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX India
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local Development
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web Components
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer Highlights
 
Live coding with LWC
Live coding with LWCLive coding with LWC
Live coding with LWC
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce data
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCP
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in Salesforce
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data Capture
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DX
 
Get Into Lightning Flow Development
Get Into Lightning Flow DevelopmentGet Into Lightning Flow Development
Get Into Lightning Flow Development
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS Connect
 

Último

React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 

Último (20)

React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
How Tech Giants Cut Corners to Harvest Data for A.I.
How Tech Giants Cut Corners to Harvest Data for A.I.How Tech Giants Cut Corners to Harvest Data for A.I.
How Tech Giants Cut Corners to Harvest Data for A.I.
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 

Git for Force.com Developers: Managing Code and Collaborating on Projects

  • 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/ git config --global user.name “” Identify yourself git config --global user.email “” to git Create your first repository 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