Git

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Git status

Shows the status of the working tree. Are there file changes, what files are ready to be committed?

Git log

Shows you the development history. Commit dates, authors, commit messages, changes made, etc

Example Scenario Workflow

- Changes to their theme: Customer makes local changes to their theme, which is tracked by git - Git add: Customer runs git add to tell git "Hey when I make my next snapshot, I want to include this file(s)" - Git commit: Customer then runs git commit to tell git "Hey take a snapshot of how things are now" and adds a commit comment. - Commits are stored in git's history so in the future we can see what was added, by whom, for what reason, to that snapshot - Git Push: Customer decides they are ready to update their site with this change. Customer then uses git push to get the file changes over to their site with WP Engine.

When a customer wants to get started using Git on our platform, there are several steps they need to take.

- First the customer must create an RSA key. - Once the key is generated, the customer must add it to the install they wish to use Git Push with in User Portal. - The customer must then wait at least ten minutes to ensure the key is fully registered. - They can then confirm access by running "ssh [email protected]". - Next, the customer must download a backup point from User Portal. - If the customer is aware that our platform matches the root of the installation with the root of their repo, they can pull only specific content that they want from a backup or SFTP. - The mu-plugins folder should be removed, but our post-receive hooks check for this to make sure that nothing changed within our own files is pushed. - From here the customer is able to set up their .gitignore file, and begin making changes.

What does Git do?

- Git helps keep track of source code for their WordPress site. - One of the biggest advantages of Git is revisions—a developer can go back to an earlier version of the code if needed. - It also lets you know who made changes to your code, what changes were made, and why those changes were made. - Git's key attributes are speed, data integrity, and support for non-linear workflows. - What it really comes down to is control.

Git ≠ SFTP

- Git is a versioning system, but SFTP is not. If a customer makes changes over SFTP, and then goes to push changes they've made in Git, it will overwrite the changes made over SFTP unless the customer downloads a new backup point containing these changes. - We recommend using Git or SFTP, not both, for this reason - Git is a one-way transaction here. - We do support git push functionality so customers can get their files here. We do not support git clone. The command may run, but most times it will not provide the customer with what they're looking for. - Many customers initially try to get their content from the server by using the git clone command. Because we use an intermediary server, most times there is nothing on the server for them to clone down to their machine. - We do kind of support git pull. However, this only pulls down files that have been pushed before (i.e. only the things that have passed through the intermediary server, to be stored there before)

Why should a customer choose to use Git instead of other development methods?

- It allows the customer to develop locally and test their code, before pushing it up to their WP Engine environment. - Git allows for "branching" of code work done by various developers, and also allows developers to "merge" their changes back together. - This is a good example of something working in staging and live wouldn't allow for. Merging changes is much more difficult than making a full copy back and forth. - If there are multiple developers working on making code changes, it helps track which developer, and which push different changes came from.

Why is this useful?

- It facilitates coordination and teamwork on projects - Customers may prefer local development before making changes to staging or live - It easily allows them to revert changes if needed. - The post-receive hooks check the syntax of their files for errors before sending the changes.

Fatal: DENIED by Fallthru

- This commonly means their RSA key hasn't been added in User Portal, or one of their remote URLs is not spelled correctly. - It could also be indicative of an outage or system-wide issue, so try your own git push to ensure it's not running into the same error, or check Support Status Tracker in HipChat for info regarding this.

Git is asking for a password when pushing.

- This commonly means they haven't added their RSA key to User Portal yet, or that they haven't waited long enough for the key to register. - It could also mean that they have multiple local keys

[Rejected] non-fast forward updates rejected

- This error means the push being made is not in "chronological order" of history. - Most common cause: 2 developers pushing to same install on the same branch. Dev A pushes plugin.php. Dev B does not have this file and tries to push. Server here rejects because they do not have changes made by other Dev.

Everything is up to date.

- This is a common error that happens when the customer pushes their changes to us, and the Intermediary server is updated - however, the Intermediary server encounters an issue (connection, server issue, etc) and fails to sync to the WP Engine server. - This causes the Intermediary server to show that the site is "up to date" when in fact it is not. - The best solution here is to have the customer add a blank line to a file, commit the change, and push once more, which forces the Intermediary server to sync again.

Why Do Customers Use Git?

Customers use git as a controlled system to track changes made to their sites.

What is Git?

Git is a Version Control System, a.k.a. a Revision Control System.

Git init

Initiates tracking for your repository (i.e. source code/files). Now git can detect file changes, updates remote repositories, etc.

Git commit

Takes a new snapshot of the repository. Comments can be added by dev for further details

Git add

Tells git you'd like to add the file(s) to the current snapshot, however it does not make a new snapshot

Git remote

This command allows you to manage the set of repositories (or "remotes") whose branches you track.

Git push

Update a remote repository with your changes. Files transferred using ssh/http/git protocol.

When a customer commits changes locally, and uses the "git push" command, the data goes from:

a) Their local machine => b) Intermediary Git Server => which then syncs with c) Their site on WP Engine

Git repo

simply put, a git repository is a place where the history of your work is stored. (source files, etc.)


Set pelajaran terkait

Katzung Pharmacology chap16 questions

View Set

RN Maternal Child Chapter 12, 13, 14

View Set

AP Human Geography 1 Multiple Choice

View Set

The nurse is planning care for a patient with RA and a history of CKD who reports increased pain from acute flare-ups. which intervention would the nurse provide?

View Set