Jump to content

Search the Community

Showing results for tags 'git'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 9 results

  1. I use git every day, but don't do much with branches because I work alone. I'm curious about something related to the branches, when a new branch is on a remote, and then it needs to be fetched and merged separately from the master branch. So pretend I'm on the master branch on my machine: git checkout -b develop # I make changes to files on develop git add . git commit -am "I have made changes to develop" git push origin develop Now there is a develop branch on the remote. Somebody else now fetches and merges (they are on master): git fetch origin # git shows that there is a new branch develop, and merge is also required for origin/master Normally without the develop branch, I would run this command from master: git merge origin/master Do I also need to checkout develop and merge origin/develop? # Do I need to do this too? git checkout develop git merge origin/develop Is there a way to merge all branches with their remote counterparts, all in one command?
  2. So basically, I have got VirtulBox set up and running on my personal mac. It's for my own learning/development really. I have installed git, gitolite and gitweb on my virtual server (Guest VM is Ubuntu) and I am getting used to the basics of git. I have a github account and I want to take my git learning to the next level and put my project on to github. I am looking in to this but VirtualBox is saying that I should install GitHub Enterprise which doesn't feel right to me. This is just one guy's development.. Instead I created a new repository on github and ran this; git remote add origin https://github.com....etc/ I got an error, fatal: unable to access 'https://github.com/[username]/[project]': Could not resolve host: github.com Is it because I am doing it from a virtual environment? Would it be easier for me to set up git on my OXS instead and push/pull from the local dev folder? I'd rather not do it that way.. Advice?
  3. I've spent the last year building a web application on my local machines using the typical LAMP stack. I've been a developer for 10+ years and am fairly good when it comes to scripting but the server/hosting/system admin thing scares me. I've taken tons of sites live but they always exist on shared hosting and require minimal maintenence...simply ftp changes...no big deal. With my latest personal projects I've used revision control (git or mercurial) simply as a way to let me work from different machines. It's awesome. I push code from home, work, and my laptop and everything is in sync with one another. It really has changed the game for me. ( I use bitbucket) My latest project will involve paying customers and has a huge code base. FTPing files is not going to cut it. I've heard of having a "staging" environment so that you can push code to the staging environment, test it, and then push to production. That sound perfect! Every time I google git/staging I get pages and pages of command line stuff. I'm used to using version control GUI's like tower and sourcetree. Are there server environments that would allow me to use a GUI to manage version control? Or are linux server environments command line only? Are there any hosting companies you know of that would be a good fit for these needs? I'm looking to keep the hosting <= $20/month Thanks
  4. Hey y'all - I have a quick question. [edit - As I type, it's becoming a not-so-quick question. Sorry about that, but I'd very much appreciate any input.] At work (we're on osX) we've recently switched to using Bitbucket with SourceTree for our version control system. I've got many project directories, already populated with working files. They're under SVN control, but honestly our SVN repo is a bit of a mess and I'm hoping to start over. My process for creating GIT repositories for each of these project directories using SourceTree is as follows: In the bookmarks window that pops up when I launch SourceTree, I click '+ New Repository' > 'Create Local Repository', then I use finder to navigate to the populated project directory and select it. I click 'Create Remote Repository', then click 'Create' to create the local repo. After filling out the remote repository owner and description, and marking it private, I click 'Create'. Then, in the browser window for the newly created repository that appears when I double click on the bookmark, I stage all the files in the local project directory and commit them. I then push that to the remote master branch. My question is this - is using the SourceTree 'Create Local Repository' option as described above equivalent to using the terminal window and 'git init' in the project directory? Everything seems to be working correctly (I've successfully committed and pushed files to the remote repositories), but I've only been using this setup for 2 days and haven't done any real heavy lifting with it yet - no branching or merging or anything of the sort. I have successfully cloned one of the repos on a secondary system, but haven't had a chance to make changes on that secondary system and commit then push them to make sure everything is actually working correctly. It certainly seems like all is well, and I have done more thorough testing on my home system, but that's a Windows box and the Windows version of SourceTree is quite different from the Macintosh version. Really, I decided to go with ST because I just don't like the command line and the price was right (free), and I'm trying to learn it as I go. I just don't want to be five or six months down the line and have to make a major change to a project only to discover that I messed up something very simple with the repository initialization and nothing's working like it should... Hopefully this is a dumb question and I'm just being paranoid, but I'd very much appreciate any input anyone with SourceTree experience has and is willing to offer.
  5. I am trying to execute git commands through exec() in php file. The php file is run in my localhost and i am trying to mainly execute these three commands:- cd change_to_git_directory git add * git commit -m hfwejfk git push but these commands are not getting executed as no changes are there in my git repository. So, what to do?
  6. I have a situation with my job where we have software versioning in place. We are having releases ever 2 weeks to a month. for example we are currently working on 2.2.1.0 and 2.3.0.0 we have requirements for 2.3 and 2.2.1 any changes we make to 2.2.1 need to be replicated in 2.3 also what is going on is they are going back to previous versions and making other corrections to 2.2.0.0 and now 2.1.4.1 and 2.1.5.0 and adding a new version 2.1.5.1 this is getting to be a little too much to keep up with and we have a team in china working with us also, and I am working and managing the project files. we have github as a repository system and have versions for 2.3, 2.2, and 2.1 the idea is that each repository will have the latest of its sub kind well, we recently released 2.2.0.0 and then started on 2.2.1.0 and then they made a bunch of changes to 2.2.0.0 and then released the package then the chineese made changes to the files that we broke off (out of repositories) after the package was released and then stuff didn't work because the chineese wanted to replace files from 2.2.1.0 into 2.2.0.0 which may also compromise the integrity of everything. I got reprimanded for not properly communicating with the chineese to stop making changes... now, they want to have a separate repository for each an every release what is the best strategy to keep up with this. It seems like it is set up to fail and have crossover that is going to break. I have done the best I can do to keep versions of every system. am I just in over my head or what?
  7. Hi, I have one big project written in PHP. We currently use Git to do the source code versioning. Now I would like to know how can I separate this big project into smaller projects, each in its subfolder? Today I have: BigProject |-- SubProject1 |-- SubProject2 |-- SubProject3 I wanted to be able to control the version of each SubProject. I'm thinking Git submodules but I read about it and it seems confusing and awkward to work with. Cheers, Bruno
  8. I'm in the process of trying to set up automatic deployments when I make a git push to my bitbucket repository. I have a php deploy script that I leveraged from http://brandonsummers.name/blog/2012/02/10/using-bitbucket-for-automated-deployments/ but when the script runs it is logging that it's only updating from a previous commit. Here is an example. Let say I log into my server and type git pull. The server will update with the latest changes and lets say the hash for that commit was 001. However if I make serveral commits lets call them 002, 003, and 004 my script should run every time assuming I pushed those changes to bitbucket after every commit. The script runs but every time it will keep the changes from 001. Only when I log into my server and type git pull, will the server update to 004. Do you know what would cause this? <?php $ajax = true; include('assets/init.inc.php'); // date_default_timezone_set('America/Los_Angeles'); // Also, this Class is not very secure... $path = dirname(__FILE__); class Deploy { /** * A callback function to call after the deploy has finished. * * @var callback */ public $post_deploy; /** * The name of the file that will be used for logging deployments. Set to * FALSE to disable logging. * * @var string */ private $_log = 'deployments.log'; /** * The timestamp format used for logging. * * @link http://www.php.net/manual/en/function.date.php * @var string */ private $_date_format = 'Y-m-d H:i:sP'; /** * The name of the branch to pull from. * * @var string */ private $_branch = 'Master'; /** * The name of the remote to pull from. * * @var string */ private $_remote = 'origin'; /** * The directory where your website and git repository are located, can be * a relative or absolute path * * @var string */ private $_directory; /** * The IP address from where BitBucket will be sending the IP address (Davey) * * @var string */ private $_ip = '63.246.22.222'; /** * The IP address from where BitBucket will be sending the IP address (Davey) * * @var string */ private $_request_method = 'POST'; /** * Error variable for processing * * @var bool */ private $_error = false; /** * Sets up defaults. * * @param string $directory Directory where your website is located * @param array $data Information about the deployment */ public function __construct($directory, $options = array()) { $this->log('Starting...'); if (stripos($this->_request_method, $_SERVER['REQUEST_METHOD']) === false) { $this->_error = true; $this->log('Request method "'.$_SERVER['REQUEST_METHOD'].'" is not valid', 'ERROR'); } else { $this->log('Request method "'.$_SERVER['REQUEST_METHOD'].'": passed. Checking IP...'); if (!empty($_SERVER['REMOTE_ADDR'])) { if (strlen($this->_ip) > 0) { if (stripos($this->_ip, $_SERVER['REMOTE_ADDR']) !== false) { $this->log('IP "'.$_SERVER['REMOTE_ADDR'].'": passed. Continuing... '); } else { $this->_error = true; $this->log('This ip "'.$_SERVER['REMOTE_ADDR'].'" is not allowed', 'ERROR'); } } if ($this->_error !== true) { // Determine the directory path $this->_directory = realpath($directory).DIRECTORY_SEPARATOR; $available_options = array('log', 'date_format', 'branch', 'remote'); foreach ($options as $option => $value) { if (in_array($option, $available_options)) { $this->{'_'.$option} = $value; } } $this->log('Attempting deployment...'); } } else { $this->log('Missing REMOTE_ADDR', 'ERROR'); } } } /** * Writes a message to the log file. * * @param string $message The message to write * @param string $type The type of log message (e.g. INFO, DEBUG, ERROR, etc.) */ public function log($message, $type = 'INFO') { if ($this->_log) { // Set the name of the log file $filename = $this->_log; if ( ! file_exists($filename)) { // Create the log file file_put_contents($filename, ''); // Allow anyone to write to log files chmod($filename, 0666); } // Write the message into the log file // Format: time --- type: message file_put_contents($filename, date($this->_date_format).' --- '.$type.': '.$message.PHP_EOL, FILE_APPEND); } } /** * Executes the necessary commands to deploy the website. */ public function execute() { try { // Make sure we're in the right directory exec('cd '.$this->_directory, $output); $this->log('Changing working directory... '.implode(' ', $output)); // Discard any changes to tracked files since our last deploy exec('git reset --hard HEAD', $output); $this->log('Reseting repository... '.implode(' ', $output)); // Update the local repository exec('git pull '.$this->_remote.' '.$this->_branch, $output); $this->log('Pulling in changes... '.implode(' ', $output)); // Secure the .git directory exec('chmod -R og-rx .git'); $this->log('Securing .git directory... '); if (is_callable($this->post_deploy)) { call_user_func($this->post_deploy, $this->_data); } $this->log('Deployment successful.'); } catch (Exception $e) { $this->log($e, 'ERROR'); } } } // This is just an example $deploy = new Deploy('/var/www/trekeffect.com/trekeffect.com'); // $deploy->post_deploy = function() use ($deploy) { // hit the wp-admin page to update any db changes // exec('curl http://www.foobar.com/wp-admin/upgrade.php?step=upgrade_db'); // $deploy->log('Done.'); // }; // file_put_contents("{$GLOBALS['path']}/deployments.log", date('c'), FILE_APPEND); $deploy->execute(); ?>
  9. What do you think? i have been looking around for something similar to use as a part of my cms. <?php class Git { private $_binPath = null; public function __construct($binPath = null){ $this->_binPath = stristr($binPath,' ') ? '"'.$binPath.'"' : $binPath; chdir(dirname(__FILE__)); } public function __call($method,$params = array()){ $addition = null; if(is_array($params)&&count($params)>0) $addition .= ' '.implode(' ',$params); exec($this->_binPath.' '.$method.$addition,$response); return $response; } } $git = new Git('C:\\Program Files (x86)\\Git\\cmd\\git.exe'); var_dump($git->init()); var_dump($git->add('.')); var_dump($git->commit('-m "Test Commit"')); var_dump($git->status()); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.