Moving multiple files at once in the online GitHub environment is not really handy. You’d have to change the name for each individual item and you can’t just drag-and-drop items. One of the easiest ways to bulk move files is by using the GitHub Desktop app. I’ll show you how to do it.
What is GitHub Desktop?
The first step is to install the GitHub Desktop app. The Desktop app is a simple client to work locally with your GitHub repositories. It eliminates the need to go to your terminal or command line and it provides a user-friendly interface to do commits, releases and pull requests.
You can download GitHub Desktop for both Windows and macOS. Install the app, login and grant it access to your repositories.
Now we’re going to clone a repository to our local environment. Then, we’ll make our edits here and push the changes back to the server.
Now that you’ve a repository cloned to your desktop, you ‘ll see this screen:
Click Show in Finder to show the files of the repository in your file explorer (I’m using Mac). You’ll see something like below:
In my case I’m using a repository with the files for a WordPress theme. All those files are now in the first level of the repository. Say that I want to put them all in one folder and put some readme’s in the first level.
To do so, select all the files and create a new folder with the items just like you’d normally do in your file explorer. Restructure the files and do all the bulk moving which you need to do.
Pushing the files to the server with GitHub Desktop
Great! Now you have successfully changed the file structure of your repository and you’ve bulk moved files. But there’s still one last step to take. The files now only live on your computer and we want to push them to the cloud.
Open up the GitHub Desktop app again and you’ll see that it has detected all the changes. Give a summary and click Commit. Click Push origin to push the files to the server.
Bulk move files with GitHub
As you’ve seen, it’s very easy to bulk move files with GitHub by using the GitHub Desktop app. This is a huge timesaver if you’d otherwise rename files and you don’t have to resort to some complex command line tool.
It must be noted, though, that there’s one downside to this method too. GitHub now thinks that you’ve 1) removed a lot of files and 2) added a lot of new files. This means that merging two branches may bring some difficulties with it. I therefore recommend this method if you don’t have a lot of branches that you want to merge in the future.