简体   繁体   中英

git push after multiple add and remove

A few days ago I create a repository with an android project that I have been working on. Since then I have deleted a number of files and have added a number of others. Now I want to push my new changes to github. How do I do that? What are the commands to issue? I know I have o commit and then push to master. But how do I tell git that I have added and deleted a number of files? Normally I just do git add . since normally I am adding stuff. But this time I have x new files and y deleted files.

To push my changes I do: 1. git add . 2. git commit -m "write my comments for change" 3. git push origin<< provide my credentials

You can use git add --all . to record all changes, including deletions. From the man page:

-A
--all
Like -u, but match against files in the working tree in addition to the index. That means that it will find new files as well as staging modified content and removing files that are no longer in the working tree.

If you want more granular control, use git rm <filespec> to remove files from the index.

After that, commit and push as usual.

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