I have been push useless commits just to ensure heroku reloads and redeploys my app after using git merge to make changes to master. Am I missing something?
EDIT
Im deploying straight from git. Hence no git push heroku master.
I found the solution.
Under the deploy tab in heroku i can choose to deploy manually from my git branch as seen below.
To make your changes appear in the remote repo, you have to push them. Your normal dev cycle should be:
Create a branch
git checkout -b NEW_BRANCH
Work & commit changes
git commit -am "commit message"
if you work in the same branch with your teammates, then you can push changes to the remote repo, but it will only push to that branch
git push REMOTE_REPO NEW_BRANCH
Merge your branch to master branch
git checkout master
git merge NEW_BRANCH
Push changes to the remote
git push <REMOTE_NAME> master
which in your caseREMOTE_NAME is heroku, so
git push heroku master
should send all your commits to deploy to heroku
Related
i trying gitlab pipeline. now i make some changes & code pushed in master branch
pipeline showing already update to date but i have changes in code
I try to pull in three phase but still same issue
.gitlab-ci.yml
before_script:
- echo "Before script"
building:
stage: build
script:
- git pull origin master
testing:
stage: test
script:
- git pull origin master
deploying:
stage: deploy
script:
- git pull origin master
If the gitlab-ci workflow starts by cloning your repository, no amount of git pull will change the fact you already have the full history, and, at the time of the workflow, this is "already up to date".
In other words, a git pull would not be needed in your gitlab-ci.yml file.
If your pipeline is running on the same repo that you changed, there is no need to use git pull. Although, if your pipeline triggers (on repo A) another pipeline on another repository (repo B), to access files in repo A, you have to pull repo A in repo B pipeline.
I have created my Heroku app via github with first commit by following commands.
git init
git add .
git commit -m "my first commit"
heroku login
heroku create
git push heroku HEAD:master
My app got created successfully. But I don't know which commands to use after then - if again i want to deploy it after making some changes in my existing code? What are the exact commands then for github and heroku both respectively.
You can re-deploy your app with the same commands you have done before.
Commands
git add .
git commit -m "new commit"
git push heroku master
Use git push for GitHub
I committed a branch and it is merged with master. Later on production, it is found to be bug in the commit.
I need to raise a PR with previous commit of master against master.
I tried the following
git checkout <specific-commit-id>
git checkout -b <new-branch-name>
git push origin <new-branch-name>
When I try to raise PR against master, it says
The source branch is 2 commits behind the target branch
Expected it to allow me to merge it in master but it didn't allow
How can I do so?
Follow the steps below,
git checkout <branch-name>
git checkout -b <new-branch-name> <properly-working-commit-id-of-current-branch-which-we-want-to-deploy>
git add .
git commit --amend -m 'commit-name'
git push origin <branch-name>
By doing so it allows us to merge in GitLab
I created a pipeline to deploy my code from Bitbucket repo to Heroku server.
my bitbucket-pipelines.yml
image: node:10.15.3
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- npm install
- git push https://heroku:<my heroku api key>#git.heroku.com/<my heroku app's name>.git HEAD
After pushing my code to my bitbucket repo, the pipeline runs, but fails while pushing the code to heroku git.
Below is the error:
Push rejected, source repository is a shallow clone. Unshallow it with `git fetch --all --unshallow` and try pushing again.
But then by bit bucket repo is not shallow. The command git rev-parse --is-shallow-repository returns false.
You can use the following git command before the push
git filter-branch -- --all
So it would be in your script:
...
- git filter-branch -- --all
- git push https://heroku:<my heroku api key>#git.heroku.com/<my heroku app's name>.git HEAD
Screenshot of GitLab UI
By default it will create a branch named after the issue from 'master'. But is there any way to create that branch from other branch other than master?
You can rebase this branch on the expected branch on CLI :
git checkout <issue-branch>
git rebase master --onto <expected-branch>