Staging Server and GIT

A staging server is a type of server that is used to test a software, website or service in a production-similar environment before being set live. It is part of a staging environment or staging site, where it serves as a temporary hosting and testing server for any new software or websites.

 

A stage or staging environment is an environment for testing that exactly resembles the production environment. In other words, it’s a complete but independent copy of the production environment, including the database. Staging provides a true basis for QA testing because it precisely reproduces what is in production.

 

The staging environment is just a final step before putting changes into production, in which you can even give access to users, so they can review content and new functionalities.

 

Version control systems are a category of software tools that help a software team manage changes to source code over time. Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.

 

Version control helps teams solve problems, tracking every individual change by each contributor and helping prevent concurrent work from conflicting. Changes made in one part of the software can be incompatible with those made by another developer working at the same time. This problem should be discovered and solved in an orderly manner without blocking the work of the rest of the team. Further, in all software development, any change can introduce new bugs on its own and new software can’t be trusted until it’s tested. So testing and development proceed together until a new version is ready.

 

Software teams that do not use any form of version control often run into problems like not knowing which changes that have been made are available to users or the creation of incompatible changes between two unrelated pieces of work that must then be painstakingly untangled and reworked. If you’re a developer who has never used version control you may have added versions to your files, perhaps with suffixes like “final” or “latest” and then had to later deal with a new final version. Perhaps you’ve commented out code blocks because you want to disable certain functionality without deleting the code, fearing that there may be a use for it later. Version control is a way out of these problems.

 

Developing software without using version control is risky, like not having backups. Version control can also enable developers to move faster and it allows software teams to preserve efficiency and agility as the team scales to include more developers.

 

Version Control Systems (VCS) have seen great improvements over the past few decades and some are better than others. VCS are sometimes known as SCM (Source Code Management) tools or RCS (Revision Control System). One of the most popular VCS tools in use today is called Git. Git is a Distributed VCS, a category known as DVCS, more on that later. Like many of the most popular VCS systems available today, Git is free and open source.

 

Git is a version control system for tracking changes in computer files and coordinating work on those files among multiple people. It is primarily used for source code management in software development, but it can be used to keep track of changes in any set of files. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows.

 

Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. Its current maintainer since 2005 is Junio Hamano.

 

As with most other distributed version control systems, and unlike most client–server systems, every Git directory on every computer is a full-fledged repository with complete history and full version tracking abilities, independent of network access or a central server.

 

Git is free software distributed under the terms of the GNU General Public License version

 

GIT Operations

Clone a repository

When you want to work on a project by changing its files or adding new files, you need to clone your project to your local system.

 

Clone over HTTPS:

$ git clone https://username@bitbucket.org/teamsinspace/documentation-tests.git

 

Clone over SSH:

$ git clone git@bitbucket.org:teamsinspace/documentation-tests.git

 

Push updates to a repo

Once you have changed your code and other files in your local repository, you will need to push them to the remote Bitbucket Cloud repository so that other people can see them too.

Git push example

$ git push

 

Work with pull requests
Pull requests are a simple and effective way to do code review and collaboration in a shared environment with little friction for your team.


git pull <remote>

 

Fetch all of the branches from the repository

 

The git fetch command imports commits from a remote repository into your local repo. The resulting commits are stored as remote branches instead of the normal local branches that we’ve been working with. This gives you a chance to review

 

git fetch <remote>

git fetch <remote> <branch>

 

Branching a Repository

Branching offers a way to work on a new feature without affecting the main codebase. You can create a branch from Bitbucket or from your terminal. After you make changes, you push your branch to Bitbucket so that you can get it reviewed with a pull request.

 

Create a Git branch

From your terminal window, list the branches on your repository.

$ git branch <feature_branch>

 

Switch to feature_branch

$ git checkout <feature_branch>

 

Commit the changes to feature_branch

$ git add .
$ git commit -m “adding a change from the feature branch”

 

Switch back to the master branch

$ git checkout master

 

Merge changes from the <feature_branch> into the master branch:

$ git merge <feature_branch>

 

Push the feature branch to the Hosting solution or cloud which hosts git repositories

(here it is Bitbucket)

$ git push origin <feature_branch>

 

List the branches

From your terminal window, list the branches on your repository.

$ git branch
* master

 

Leave a Reply

Your email address will not be published. Required fields are marked *