Mediabistro Git Configuration: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
(Created page with "ssh: [uname]@wmbdev1.iworld.com Category:GIT Category:Mediabistro")
 
No edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Configuration==
===Logins & workflow===
ssh: [uname]@wmbdev1.iworld.com
ssh: [uname]@wmbdev1.iworld.com


[[Category:GIT]]
[http://git.iworld.com/blogs/repository Git repositories (web interface)] l/p:email/super-basic
[[Category:Mediabistro]]
 
[http://wiki.mediabistro.net/index.php?title=Git Git on mediabistro wiki] (including basic workflow)
 
===Repositories===
After logging in with SSH repos are found at
 
<code>/www/[SITENAME]/git/[USERNAME]/[SITENAME]/</code>
 
E.g. if my username is <code>dbarchowsky</code> and I need to work on the <code>blogs</code>:
 
<syntaxhighlight lang="bash">
$ cd /www/blogs/git/dbarchowsky/blogs/
</syntaxhighlight>
 
== Cloning an existing repo ==
 
How to start working on an existing repo for the first time.
 
* `ssh` to `wmbdev1.iworld.com`
* Navigate to the appropriate directory and create a sandbox.<br />Using '''insidefacebook''' as an example:
<syntaxhighlight lang="bash">
$ cd /www/insidefacebook/git/
</syntaxhighlight>
<strike>$ mkdir dbarchowsky</strike>
<strike>$ cd dbarchowsky</strike>
* Clone the repo.
:* Find the project on http://git.iworld.com
:* Make a note of its clone property.
<syntaxhighlight lang="bash">
$ # the argument to "git clone" comes from the project proeperties found on git.iworld.com
$ git clone git@git.iworld.com:insidefacebook.git
</syntaxhighlight>
:* In the case of `insidefacebook` this creates a root directory "insidefacebook" with another "insidefacebook" directory inside of that. It was necessary to install the root "insidefacebook" directory in `/www/insidefacebook/git/` and then rename the root "insidefacebook" directory to "dbarchowsky" to create the sandbox.
:* Copy a `wp-config.php` file from an existing sandbox.
:* No edits are necessary to the new copy of `wp-config.php`. Optionally edit it to make `WP_DEBUG true`.
* Create a branch for the new task.
<syntaxhighlight lang="bash">
$ cd insidefacebook
$ git branch
$ # response should be "* master"
$ git co -b tm[TASK_ID]
$ git branch
$ # response should be " master" followed by "* tm[TASK_ID]"
</syntaxhighlight>
* Tar up the repo.
<syntaxhighlight lang="bash">
$ tar -czvf insidefacebook.tar.gz insidefacebook
</syntaxhighlight>
* FTP to the server.
* Download the tar file.
* Uncompress the tar file in the local working directory.
* Create a new PHP project in NetBeans.
** Set the '''run configuration''' for the project such that the files are uploaded to the sandbox on wbmdev1.iworld.com when they are saved.
** It's not necessary to have the project in a git repo locally. The repo is maintained on the sandbox on wmbdev1.iworld.com.
** After a file is uploaded, at the command line on the wmbdev1.iworld.com server:
<syntaxhighlight lang="bash">
$ git status -s
$ # the response should include the file that was uploaded
</syntaxhighlight>
 
==Basic workflow for a new task==
 
===Update Git repo and create new branch===
* Log in with SSH.
* Navigate to the appropriate Git repo (see [[#Repositories|Repositories]])
* Get latest version of code
<syntaxhighlight lang="bash">
$ git co master
$ git pull
$ git co -b tm[TASK_ID]
</syntaxhighlight>
 
=== Make edits with NetBeans IDE ===
 
* Create a NetBeans project to download and upload local from the blogs sandbox. (This only needs to be done once.)
** Project URL: [sandbox url] e.g. <code>http://dbarchowsky.blogs.mediabistro.com/</code>
** Remote Connection: <code>wmbdev1.iworld.com</code>
** See [[Git_Workflow#Netbeans|Setting up Remote Connection in NetBeans IDE]]
** Upload Files: "On Save"
[[file:Netbeans-wmbdev1-settings.png|thumb|NetBeans remote connection settings for wmbdev1.iworld.com]] [[file:Netbeans-wmbdev1-run-configuration.png|thumb|NetBeans run configuration for wmbdev1.iworld.com]]
* Before editing files, right click on the file and select 'Download'.
* Edits will be uploaded to the sandbox with each save.
* Preview changes on the sandbox. E.g. http://dbarchowsky.blogs.mediabistro.com/tvnewser/
 
===Checking in edits===
* See [http://wiki.mediabistro.net/index.php?title=Git#Committing_changes|"Committing changes" on the Mediabistro Wiki]
<syntaxhighlight lang="bash">
$ git status -s
$ git add [PATH]
$ git commit -m "[task title]"
$ git push origin tm[TASK_ID]
</syntaxhighlight>
* The convention is to copy the task title from the task details and use that for the commit message.
 
===Moving changes to preview (for review)===
<syntaxhighlight lang="bash">
$ cd /www/[APPLICATION]/git/preview/
$ git fetch
$ git merge remotes/origin/tm[TASK_ID]
</syntaxhighlight>
 
Now the changes will be visible at http://preview.blogs.mediabistro.com/[BLOG_TITLE]/
 
=== Documentation & release notes ===
* QA Links: <code><nowiki>http://preview.blogs.mediabistro.com/[BLOG_TITLE]/</nowiki></code>
* Application Changes: <code><nowiki>http://git.iworld.com/blogs/commits?ref=tm[TASK_ID]</nowiki></code>
 
== Syncing a sandbox repo with the work of others ==
 
Scenario:
* I start working in my sandbox/repo using my own branch.
* Someone else works on the same set of files in their sandbox/repo.
* Now I need to make additional edits.
* The goal is to make sure that my edits don't overwrite the other work done in any other sandboxes.
* This assumes that once they were done with their work they pushed it out to `master`.
 
<syntaxhighlight lang="bash">
$ git co <mybranch>
$ git fetch
$ git rebase remotes/origin/master
</syntaxhighlight>
 
More information on `git rebase`: [http://git-scm.com/book/en/Git-Branching-Rebasing|Git Documentation: 3.6 Git Branching - Rebasing]
 
==See Also==
 
[[Mediabistro Blogs Configuration]]
 
[[Category:Git]] [[Category:Mediabistro]]

Latest revision as of 23:41, 23 April 2013

Configuration[edit]

Logins & workflow[edit]

ssh: [uname]@wmbdev1.iworld.com

Git repositories (web interface) l/p:email/super-basic

Git on mediabistro wiki (including basic workflow)

Repositories[edit]

After logging in with SSH repos are found at

/www/[SITENAME]/git/[USERNAME]/[SITENAME]/

E.g. if my username is dbarchowsky and I need to work on the blogs:

$ cd /www/blogs/git/dbarchowsky/blogs/

Cloning an existing repo[edit]

How to start working on an existing repo for the first time.

  • ssh to wmbdev1.iworld.com
  • Navigate to the appropriate directory and create a sandbox.
    Using insidefacebook as an example:
$ cd /www/insidefacebook/git/

$ mkdir dbarchowsky $ cd dbarchowsky

  • Clone the repo.
$ # the argument to "git clone" comes from the project proeperties found on git.iworld.com
$ git clone git@git.iworld.com:insidefacebook.git
  • In the case of insidefacebook this creates a root directory "insidefacebook" with another "insidefacebook" directory inside of that. It was necessary to install the root "insidefacebook" directory in /www/insidefacebook/git/ and then rename the root "insidefacebook" directory to "dbarchowsky" to create the sandbox.
  • Copy a wp-config.php file from an existing sandbox.
  • No edits are necessary to the new copy of wp-config.php. Optionally edit it to make WP_DEBUG true.
  • Create a branch for the new task.
$ cd insidefacebook
$ git branch
$ # response should be "* master"
$ git co -b tm[TASK_ID]
$ git branch
$ # response should be " master" followed by "* tm[TASK_ID]"
  • Tar up the repo.
$ tar -czvf insidefacebook.tar.gz insidefacebook
  • FTP to the server.
  • Download the tar file.
  • Uncompress the tar file in the local working directory.
  • Create a new PHP project in NetBeans.
    • Set the run configuration for the project such that the files are uploaded to the sandbox on wbmdev1.iworld.com when they are saved.
    • It's not necessary to have the project in a git repo locally. The repo is maintained on the sandbox on wmbdev1.iworld.com.
    • After a file is uploaded, at the command line on the wmbdev1.iworld.com server:
$ git status -s
$ # the response should include the file that was uploaded

Basic workflow for a new task[edit]

Update Git repo and create new branch[edit]

  • Log in with SSH.
  • Navigate to the appropriate Git repo (see Repositories)
  • Get latest version of code
$ git co master
$ git pull
$ git co -b tm[TASK_ID]

Make edits with NetBeans IDE[edit]

NetBeans remote connection settings for wmbdev1.iworld.com
NetBeans run configuration for wmbdev1.iworld.com

Checking in edits[edit]

$ git status -s 
$ git add [PATH]
$ git commit -m "[task title]"
$ git push origin tm[TASK_ID]
  • The convention is to copy the task title from the task details and use that for the commit message.

Moving changes to preview (for review)[edit]

$ cd /www/[APPLICATION]/git/preview/
$ git fetch
$ git merge remotes/origin/tm[TASK_ID]

Now the changes will be visible at http://preview.blogs.mediabistro.com/[BLOG_TITLE]/

Documentation & release notes[edit]

  • QA Links: http://preview.blogs.mediabistro.com/[BLOG_TITLE]/
  • Application Changes: http://git.iworld.com/blogs/commits?ref=tm[TASK_ID]

Syncing a sandbox repo with the work of others[edit]

Scenario:

  • I start working in my sandbox/repo using my own branch.
  • Someone else works on the same set of files in their sandbox/repo.
  • Now I need to make additional edits.
  • The goal is to make sure that my edits don't overwrite the other work done in any other sandboxes.
  • This assumes that once they were done with their work they pushed it out to master.
$ git co <mybranch>
$ git fetch
$ git rebase remotes/origin/master

More information on git rebase: Documentation: 3.6 Git Branching - Rebasing

See Also[edit]

Mediabistro Blogs Configuration