in Git by
What are the steps of git local workflow?

▼ Show 1 Answer

0 votes
For starting local, we initialize our current working project directory using 'git init' or 'git init <your-project-name>'(this will create a new directory with provided your-project-name as working directory) command and on the GitHub site set up your GitHub repository.

Now in the local working directory, we do changes (either adding/editing files etc)

Then we're going to 'stage' our changes using the "git add" command

Then commit our changes that are in the staging area using the 'git commit -m <your custom message here>'

Setup a remote repository (origin) using command 'git remote add origin [email protected]:User/UserRepo.git' (you can change it later using command 'git remote set-url origin [email protected]:User/UserRepo.git')

Once we're ready to collaborate with others on the main repository, we'll push our changes up to our remote repository on GitHub(or the hosted remote repository) using command 'git push -u origin master'; here -u is upstream(use it only for first push command just once), origin is remote name and master is the branch's name.

Once everyone else had pushed their changes to the remote repository,then we'll do a pull from the remote repository to our local git repository using 'git pull' or 'git pull <remote-name> <branch-name>' command

 Later on whenever doing new working the local repo; do 'git pull' and then start new work
Learn More with Madanswer

Related questions

0 votes
asked Jan 6 in Git by GeorgeBell