9579

making latest commit master (git)

Question:

Here's what I usually do:

$ git add . -Av $ git commit -m "I want this to be master"

but when I try to push to remote, "everything is up-to-date" and the latest commit isn't master.

$ git branch * (HEAD detached from f0efe1a) added_mongodb_auth master serviceworkers_branch

How can I make the latest commit the Master?

Answer1:

Looking at the output of git branch, it appears you're not currently on any branch (called a "detached HEAD" state).

To be on the safe side, first create a new branch ("save-my-work") containing the commits you've created so far:

$ git branch save-my-work

Now, to include these commits in the master branch:

$ git checkout master $ git merge save-my-work

Now you should by able to push as usual. If you're sure that master is in the state that you want it, you can delete save-my-work again:

$ git branch -d save-my-work <hr />

Tip: Use a graphical repository viewer like gitk to have a better overview of the state of the repository.

Recommend

  • Nhibernate Flush works commit doesn't
  • ObjectContext tracking changes in Entity Framwwork
  • Get a series of commits on a detached head onto a branch
  • Passing/giving commands to CMD through Qt GUI
  • What is the difference between getHibernateTemplate().update and getHibernateTemplate().merge
  • Reset to the very first commit in Git?
  • Powershell Hash Table to HTML
  • Custom WebViewPage inject code when razor template is rendering
  • How do I change the kernel/python version for iPython?
  • how to query for min or max inet/cidr with postgres
  • What's the name of this finding square root algorithm?
  • How do I bind multiple properties in an Android layout element
  • Get the pasted content on document on paste event
  • Connecting bluetooth device to windows phone 8 application
  • google maps autocomplete bounces back already cleared text …odd…odd…odd
  • Cannot save model when using ember render helper
  • MeeGo Handset Emulator not starting on Windows 7
  • How to use Windows Media Foundation with UWP without a topology
  • Prevent Tomcat from caching request during starup
  • Jquery Knockout: ko.computed() vs classic function?
  • Why isn't obj.style.left = “200px”; working in this code?
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • How to autopopulate a field in SugarCRM form
  • Tell Git to stop prompting me for conflicts when none really exist?
  • Ember.js model to be organised as a tree structure
  • Differences in dis-assembled C code of GCC and Borland?
  • Xcode 4 NSLog Macro link in Xcode 3
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Jquery UI tool tip close icon
  • Is it possible to access block's scope in method?
  • Meteor: Do Something On Email Verification Confirmation
  • Google Custom Search with transparent background
  • Get one-time binding to work for ng-if
  • Display issues when we change from one jquery mobile page to another in firefox
  • Is there any way to access browser form field suggestions from JavaScript?
  • Why winpcap requires both .lib and .dll to run?
  • How to set the response of a form post action to a iframe source?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • unknown Exception android
  • How to Embed XSL into XML