Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3783720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:16:03+00:00 2026-05-19T11:16:03+00:00

I’m just picking up git , after years of svn and cvs . I’ve

  • 0

I’m just picking up git, after years of svn and cvs. I’ve got the hang of most of it, but I don’t feel like my common usage sequence is optimal.

My setup:
I do development on my workstation with a local, cloned repository from the origin server, which on my project, is being treated like a “master” repository. I do git fetch regularly, check the new updates, then git merge to merge them if they are relevant.

However, it is when I’m working on and checking in a branch of code wherein my doubt lies.

A common sequence I use:

git branch somenewbranch
git checkout somenewbranch
... work work work ...
git add [changed files]
git commit
git checkout master
git merge somenewbranch
git branch -d somenewbranch

Here is what I think could be optimized:

git push origin master:blahblah         # This won't let me push to master branch
ssh origin
cd repodir
git merge blahblah
git branch -d blahblah
logout
git status                              # this shows me I'm still ahead
git pull origin                         # to bring them back in sync
git remote show origin                  # shows I have a stale blahblah branch
git remote prune origin                 # cleans that up

And now I’ve got them synchronized. This seems like a lot of extra steps to sync my local and the “master” repository.

Can someone help me optimize my usage?

Thank you.

EDIT: If I don’t do the separate branch, I receive an error that states:

remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:16:03+00:00Added an answer on May 19, 2026 at 11:16 am

    If you just use git push after you’ve made changes, and you are ahead of origin/master, then everything should go fine. Why are you explicitly specifying a different remote branch to push your local master branch to?

    Are you having trouble pushing to your origin repository because it’s complaining about a checked-out branch? If so, you are making a common mistake. You need to be using a bare repo as your origin so that Git can accept changes without causing problems with the working copy on the server.

    Setting up a Private (bare) Repo

    How to convert a normal Git repository to a bare one?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to run a str_replace or preg_replace which looks for certain words
I have a French site that I want to parse, but am running into
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.