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.
-
checkout master and commit. But why have you not already committed? Commit early, commit often.– William PursellCommented Sep 24, 2020 at 2:26
Add a comment
|
1 Answer
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'
-
alternate
andmaster
originated from the same commit - verified this by runninggit branch -v
. Is that what's meant by "alternate is still at the same revision of master"?– knot22Commented Sep 24, 2020 at 2:29