Giter Site home page Giter Site logo

git-commands's Introduction

Git Commands

Sync upstream with local master

git checkout master
git fetch MTT // Fetch is used to pull from a remote repo
git merge MTT/master // merge upstream with local fork
git push origin master

Merge master into working branch

git checkout <branch_name>
git merge master
git commit -m "Merging master into working branch <branch name>"
git push origin <branch name>

List remote repos

anthony@ghost:~$ git remote -v
MTT	[email protected]:upstream-name/repo-name.git (fetch)
MTT	[email protected]:upstream-name/repo-name.git (push)
origin	[email protected]:amboxer21/repo-name.git (fetch)
origin	[email protected]:amboxer21/repo-name.git (push)
anthony@ghost:~$

List remote branches

anthony@ghost:~$ git branch -r
  MTT/Add-CodeCov-Token
  MTT/baresip
  MTT/bluetooth-ios-fix
  ...
  ...
  MTT/recordinglogging
  MTT/revert-1077-hop_logging
  MTT/revert-1106-introduce-unions-as-optimizati
  ...
  ...
  MTT/softbuttons
  MTT/stable
  origin/AutomatedCallingGroupsLeadingZeroFix
  origin/CDRDownloadAdditionalFields
  origin/E911WorkGroups
  origin/E911WorkGroups2
  origin/HEAD -> origin/master
  ...
  ...
anthony@ghost:~$

How to checkout a remote branch thats not on our local machine.

anthony@ghost:~$ git fetch origin
anthony@ghost:~$ git checkout --track <branch name> origin/<branch name>

Releasing code into production for hosted

Step 01: Merge your PR(s) in/at github.com
Step 02: Open new PR merging upstream-name/repo-name master into upstream-name/repo-name stable
Step 03: Merge that pull request to merge your changes into the stable branch.
Step 04: Run bundle exec cap production deploy from your local machine where your code was written from
Step 05: Once that is done go to the hpbxgui folder on the app server.
Step 06: Set rails env to production via export RAILS_ENV=production
Step 07: Run migrations if need be 
Step 08: Run any tasks that are needed as well
Step 09: Perform a touch tmp/restart.txt
Step 10: Test release
Step 11: Restart CTI and AMI via /etc/init.d 
example:
[aguevara@app-server hpbxgui]$ sudo /etc/init.d/cti restart
[aguevara@app-server hpbxgui]$ sudo /etc/init.d/ami_fw_proxy restart

Creating a new upstream

List the current configured remote repository for your fork

anthony@ghost:~$ git remote -v
origin  [email protected]:amboxer21/hosted.git (fetch)
origin  [email protected]:amboxer21/hosted.git (push)
anthony@ghost:~$

Specify a new remote upstream repository that will be synced with the fork

anthony@ghost:~$ git remote add MTT [email protected]:upstream-name/repo-name.git

Verify the new upstream repository you've specified for your fork

anthony@ghost:~$ git remote -v
MTT [email protected]:upstream-name/repo-name.git (fetch)
MTT [email protected]:upstream-name/repo-name.git (push)
origin  [email protected]:amboxer21/repo-name.git (fetch)
origin  [email protected]:amboxer21/repo-name.git (push)
anthony@ghost:~$

Above instructions can be found HERE

Patching production during work hours(outside of maintenance window)

Step 01) Merge your PR in/at github.com
Step 02) Add .patch to the end of the URL
example:
github.com/upstream-name/repo-name/pull/2485.patch
Step 03) Copy the url that now has a hash appended to it.
Step 04) SSH into the app server
Step 04) gain root access
Step 06) change your dir to /var/asterisk/hosted/current
Step 07) Use wget to pull the patch file in to the app server
example:
[root@app-server current]# wget https://patch-diff.githubusercontent.com/raw/upstream-name/repo-name/pull/2484.patch?token=AAQAYIT7XZ52BNNU3RJYSUK5XSPIW -O 2484.patch --no-check-certificate
Step 08) Run -> git apply --check 2484.patch
Step 09) If everything checks out then run the git apply command with out the --check option
Step 10) Run a touch tmp/restart.txt (still on the app server)

git-commands's People

Contributors

amboxer21 avatar

Stargazers

Ali Shujaau avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.