I'm putting some Apache config files into a Git repository. The two servers should in theory have identical configurations. I've created a repository, committed the files and pushed the branch from the first server to the remote repository, and now I'm trying to check out the branch on the second server without touching any files.
The idea is that once I've checked out the branch, I can use git status
to confirm that the files are identical on both servers (I've already manually spotted a minor difference). Any important differences can then be tracked in a separate branch. These are production servers, so I don't want to get anything wrong, even temporarily.
I'm used to using a GUI Git and I haven't used command line Git much. I only have shell access to the servers.
App-01 git show-branch -a
:
* [master] Initial commit
! [origin/master] Initial commit
--
*+ [master] Initial commit
App-02 git show-branch -a
:
[origin/master] Initial commit
I tried the solutions at switch git branch without files checkout (git symbolic-ref HEAD refs/heads/<otherbranch>
then git reset
) but looking back I think they presume an already existing local branch.
When I do git status
on the second server, it shows all files as unstaged.
Is it possible to checkout a new branch without changing any local files? If so, what command(s) would do the trick?