简体   繁体   中英

Git switching between branches

I'm still new with Git so apologies for the noob question. Previously I've used SVN and worked on projects that had multiple branches. I'd have multiple VS solutions open at once, or at the very least switch frequently between them.

With Git I understand having multiple branches open at one is not possible, so switching between them becomes rather tedious.

Just curious as to what the best strategy would be for accommodating this kind of workflow.

In git , it is perfectly normal to frequently switch between branches locally, because such switches do not require a round trip to the server and are fast.

Also, if you merely need to see Branch A's version of a file while working on Branch B, you can just use git show A:path/to/file on the command line.

Similarly, if you want to do a diff between two branches version of a file, you can do

git diff A B -- path/to/file

If you really want to have multiple branches checked out at once, then just git clone the repository multiple times, and check out a different branch on each clone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM