0

In a project with a local Git repository a new branch called alternate was created from the master branch and changes were made to files in the working tree. These changes have reached a point where they're ready to be pushed to the master branch. The changes have not been committed yet on either master or alternate. Is there a way to commit these changes directly to the master branch without having to commit them on alternate and then do a merge with master? Note that this project does not have a remote Git repository.

1
  • checkout master and commit. But why have you not already committed? Commit early, commit often. Commented Sep 24, 2020 at 2:26

1 Answer 1

1

I asume that alternate is still at the same revision of masterr? If that is the case, just checkout master, it won't change anything in the working tree and then follow procedure to create a revision:

git checkout master
git add file1 file1
git commit -m 'new revision'
1
  • alternate and master originated from the same commit - verified this by running git branch -v. Is that what's meant by "alternate is still at the same revision of master"?
    – knot22
    Commented Sep 24, 2020 at 2:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.