Everything in the know (everything that is wrong)

So, I'm trying to get my intermediate branch to work all day, but I'm missing something.

This is a chain of events:

git branch develop *master staging 

make some changes

 git checkout staging M app/views/comments/index.html.erb M app/views/devise/registrations/new.html.erb M app/views/devise/sessions/new.html.erb M app/views/layouts/application.html.erb M app/views/songs/contact.html.erb M app/views/songs/faq.html.erb M app/views/songs/index.html.erb M app/views/songs/new.html.erb M app/views/songs/new_songs.html.erb Switched to branch 'staging' git gui (git commit and then git push staging) git checkout master git push staging master (deployment) Everything up-to-date 

Everything is not updated, I made 10 changes that I would like to see on my intermediate server.

How can I get this job?

+4
source share
2 answers

There is no key step in your workflow: adding changes before they are implemented.

Before using git commit , run git add -A to add all the files to the working directory in the git repository. Alternatively, you can use git add <path-to-file> to add a specific file, or use git commit -a to add all the changes to the git repository. Note, however, that git commit -a will not add new files, it will simply add the changes you made to existing files.

If you want to see where you are, enter git status . Red files change, non-stationary ("setting" the change is equivalent to "adding"), while green files are added. If git status says "the working directory is clean", then you have not made any changes since the last commit.

+1
source

Make sure you often use git status (or git status --short ). Whenever it shows changes, you have to decide whether you want to save them or not. Then you commit them or discard them. - After that, git status is happy again. Setting up a meaningful prompt is usually very helpful.

Do not change the branch without a clean git status . (It only worked because both branches were pretty much equal.)

The main problem is your push. git push is required to specify the remote (usually called origin ). If you really want to push the contents of your local intermediate branch to the remote master, you can do it with git push origin staging:master , but it will be pretty confident to make things even more complex.

You have two options: either go with only one main branch, or with an additional intermediate branch.

  • Using only the wizard, you transfer the changes from the remote wizard that created (or updates) the local wizard. Then you make your commits on your local master and, when done, push your local master back to the remote master, which should deploy it.
  • Using a separate branch branch, you can make your changes in the intermediate branch so that your local intermediate branch moves to the remote intermediate branch, where you can expand it, this is some kind of intermediate region. If you are satisfied with the results, you merge pass the branch to the master branch and click the resulting wizard now, containing all the changes to the stage.
0
source

Source: https://habr.com/ru/post/1497495/


All Articles