Git Adds Switch And Restore
Written by Kay Ewbank   
Wednesday, 21 August 2019

The latest version of Git, the distributed version control system, has been released with around 500 changes, including two new sub-commands that are designed to provide an experimental alternative to git checkout. The git switch and git restore sub-commands are designed to make it clear whether the intention is to change files or to change branches.

Git switch is used to switch to a new branch (if necessary creating it first), while git restore can be used to restore changes from a given commit. The team developing Git say that using git checkout for both these functions caused confusion among some new users of Git.  

gitlogo

 The development team says that while you can think of git switch as acting like the optionless invocation of git checkout, git restore is more interesting. When you use git restore to restore changes from a commit, it makes it easier to work out exactly which files will change, what they’ll change to, and where they’ll change. It has two options to specify where your restored changes will go - the working copy or your index. It also makes it easier to understand where the contents you’re restoring come from with an optional --source option.

In addition to the two new sub-commands, the new release also adds the ability to use references from an alternate as part of a connectivity check. What this means is that once Git has received all of a repository’s objects when cloning, when it is doing its check that all of the objects needed are accessible,it will check a path supplied as an alternative location from where the 'main' object store can borrow objects from.

Git 2.23 now makes it possible to treat those known-connected objects as a stopping point for the connectivity check, meaning it has to look at fewer objects, which makes it quicker.

 

gitlogo

More Information

Git Official Site 

Related Articles

Git Improves Usability

Git Adds Protocol Version 2 Support

Git 2.17 Clarifies Moved Code

Git 2.5 Released 

Visual Studio To Get Git

Git Support for Google Code Project Hosting

 Windows Source Now In A GIT Repository

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


FSF Hackathon To Improve Free Software
18/05/2025

This year the Free Software Foundation is marking its 40th Anniversary and is running a global online Hackathon open to everyone in the free software community. For projects interested in partici [ ... ]



GitLab 18 Extends Duo AI Feature
29/05/2025

GitLab 18 has been released with extensions to the Duo AI-based assistant. The news was followed by reports that Duo had a security vulnerability that provided a route for attackers. The problem has n [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info